Motor control method, motor driver, computer equipment and storage medium

By adjusting the d-axis reference current based on the difference value of the bus voltage and the target voltage in the motor control system, and adjusting the target voltage according to the feedback current, the problem of current out of control at high speed is solved, and higher control accuracy and performance are achieved.

CN119652188APending Publication Date: 2025-03-18SHENZHEN SHUMA ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411815750.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing motor control methods are difficult to achieve effective current control in high speed scenarios, resulting in current loss of control, jitter, noise and step loss.

Method used

By adjusting the process based on the difference between the bus voltage and the previous target voltage, the d-axis reference current is obtained, and the target voltage is adjusted according to the feedback current of the motor to ensure that the voltage output by the current loop is within the bus voltage range, thereby achieving controllability of the current.

Benefits of technology

It effectively avoids current outage and improves motor control accuracy and performance, especially in high speed scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652188A_ABST
    Figure CN119652188A_ABST
Patent Text Reader

Abstract

The invention relates to a control method of a motor, a motor driver, computer equipment and a storage medium. The method comprises the steps of performing adjustment processing based on a difference value between a bus voltage and a previous target voltage of a motor to obtain a d-axis reference current; the previous target voltage is determined according to a previous first reference voltage and a previous second reference voltage; performing adjustment processing based on the d-axis reference current and a first feedback current of the motor to obtain a first reference voltage; performing adjustment processing based on the q-axis reference current and a second feedback current of the motor to obtain a second reference voltage; and driving the motor to operate based on the first reference voltage and the second reference voltage. By adopting the method, the motor control precision and performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a motor control method, a motor driver, a computer device and a storage medium. Background Art

[0002] Motors are widely used in industrial control and medical fields. Currently, there are two control methods for motors: open-loop control and closed-loop control. In the open-loop control method, there is a method of directly inputting pulse control based on the step angle; as well as current closed-loop control, speed and position open-loop control methods. Some methods achieve closed-loop control by feedback position through back-electromotive force. The closed-loop control method uses an encoder to feedback the rotor position to achieve closed-loop control of speed or position. However, the above methods are difficult to apply in high-speed scenarios, which will lead to current out-of-control problems in high-speed scenarios. Summary of the invention

[0003] Based on this, it is necessary to provide a motor control method, motor driver, computer device and storage medium to address the above technical problems, which can improve the motor control accuracy and performance.

[0004] A method for controlling a motor, the method comprising:

[0005] Performing an adjustment process based on the difference between the bus voltage and the previous target voltage of the motor to obtain a d-axis reference current; the previous target voltage is determined based on the previous first reference voltage and the previous second reference voltage;

[0006] Performing adjustment processing based on the d-axis reference current and the first feedback current of the motor to obtain a first reference voltage;

[0007] Performing adjustment processing based on the q-axis reference current and the second feedback current of the motor to obtain a second reference voltage;

[0008] The motor is driven to operate based on the first reference voltage and the second reference voltage.

[0009] A motor driver is characterized in that the motor driver is used to implement the steps of the control method embodiment of each motor.

[0010] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of an embodiment of a control method for each motor when executing the computer program.

[0011] A computer-readable storage medium stores a computer program, which implements the steps of the control method embodiment of each motor when the computer program is executed by a processor.

[0012] The control method, motor driver, computer device and storage medium of the above-mentioned motor can determine the given current of the motor by performing adjustment processing based on the difference value between the bus voltage and the previous target voltage to obtain the d-axis reference current; and because the target voltage changes with the feedback current of the motor, the d-axis reference current is adjusted accordingly so that the d-axis reference current decreases, and the voltage output by the current loop, i.e., the target voltage, is within the bus voltage range, so that the feedback current of the motor can reach the reference current, i.e., the current is controllable, thereby avoiding current runaway and improving the motor control accuracy and performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 A diagram showing an application environment of a method for controlling a motor in an embodiment;

[0014] Figure 2 A schematic diagram of the relationship between the rotation speed and the actual current in one embodiment;

[0015] Figure 3 Schematic diagram of the a-axis, b-axis, d-axis and q-axis of a motor in one embodiment;

[0016] Figure 4 A schematic flow chart of a method for controlling a motor in one embodiment;

[0017] Figure 5 is a flow chart of a method for controlling a motor in one embodiment;

[0018] Figure 6 is a flow chart of a method for controlling a motor in one embodiment;

[0019] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0020] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] It should be noted that all directional indications in the embodiments of the present application (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. The connection can be a direct connection or an indirect connection.

[0023] In addition, in this application, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0024] The terms "first", "second", etc. used in this application may be used herein to describe various data, but these data are not limited by these terms. These terms are only used to distinguish the first data from another data. For example, without departing from the scope of this application, the first reference voltage may be referred to as the second reference voltage, and similarly, the second reference voltage may be referred to as the first reference voltage. Both the first reference voltage and the second reference voltage are reference voltages, but they are not the same reference voltage.

[0025] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.

[0026] The motor control method provided in this application can be applied to Figure 1 application environment. Figure 1 1 is an application environment diagram of a motor control method in an embodiment, which includes a motor driver 110 and a motor 120. The motor 120 can be a permanent magnet synchronous motor, a brushless DC motor, a stepper motor, a multi-phase motor, etc., regardless of the type of motor.

[0027] In one embodiment, Figure 2As shown in the figure, it is a schematic diagram of the relationship between the speed and the actual current in one embodiment. The actual voltage of the motor is composed of the back electromotive force, the inductor voltage and the resistor voltage. The traditional method gives a constant reference current, and the motor can reach the reference current when running at a low speed. As the motor speed increases, the back electromotive force of the motor increases, and the required voltage of the motor also increases; as the voltage required by the motor reaches the bus voltage, the speed continues to increase, then the voltage allocated to the resistor decreases, and the current decreases, that is, the following occurs. Figure 2 In the weak magnetic interval of the motor, if a constant reference current is given, at high speed, the current loop must control the target voltage to reach the reference current, and the output target voltage will be very large. However, the voltage that the motor driver can output is limited by the bus voltage, and the maximum output is only the bus voltage. Therefore, the current cannot reach the reference current, resulting in current loss of control, which causes a series of problems such as jitter, noise, and loss of step. Therefore, the control method of the motor in each embodiment of the present application is proposed. Figure 3 Schematic diagram of the a-axis, b-axis, d-axis and q-axis of a motor in one embodiment. Figure 3 The square in the figure is the rotor position, and the angle between the d-axis and the a-axis is the electrical angle θ of the motor. e , which changes with the motor speed. The motor control scheme can be selected to add the motor current is to the d-axis. Specifically, for an open-loop system, since the actual position of the motor is not obtained, the d-axis is determined based on the command rather than the actual d-axis.

[0028] like Figure 4 FIG. 1 is a flow chart of a method for controlling a motor in an embodiment, which is applied to a motor driver as an example, and includes the following steps:

[0029] Step 402, performing adjustment processing based on the difference between the bus voltage and the previous target voltage of the motor to obtain a d-axis reference current; the previous target voltage is determined based on the previous first reference voltage and the previous second reference voltage.

[0030] The previous target voltage is determined according to the previous reference voltage and the previous second reference voltage. Specifically, the previous target voltage may be a larger value of the previous reference voltage and the previous second reference voltage.

[0031] Specifically, during the operation of the motor, the theoretical d-axis current is a value with a smaller range of variation, rather than the trigonometric function value of the ab-axis current, so it is easy to set the reference value. Based on the difference between the bus voltage Udc and the previous target voltage of the motor, the adjustment process is performed to obtain the d-axis reference current. The difference value can be represented by a difference value, an error value, etc. The adjustment process can specifically be PI (proportional integral controller) adjustment, PR (Proportional-Resonant Controller) adjustment, etc., which can convert the voltage value into a current value, or convert the current value into a voltage value. Compared with the method of fixing the reference current, in the process of increasing the speed of this embodiment, the voltage output by the current loop (such as the first reference voltage, the second reference voltage and the target voltage) will not decrease, and will fluctuate near the bus voltage after reaching the bus voltage.

[0032] Taking the voltage error as the absolute value of the bus voltage minus the target voltage as an example, at the moment of entering the weak magnetic interval, that is, when the bus voltage U dc With the target voltage U target After the target voltage is the same, the target voltage increases (at this moment, the target voltage>bus voltage), the difference between the two is less than 0 and the error increases. Under the action of the voltage PI controller, the d-axis reference current decreases, the target voltage output by the current loop decreases, and the error value decreases; when the target voltage decreases to less than the bus voltage, the difference between the two is greater than 0 and the error increases. Under the action of the voltage PI controller, the d-axis reference current increases, and the target voltage output by the current loop increases. The above process is repeated, and the d-axis reference current oscillates with a small amplitude, and as the speed increases, the d-axis reference current decreases.

[0033] Optionally, the motor control scheme may be selected such that the motor current is is added to the d-axis, so theoretically there is current only on the d-axis, and the q-axis current is 0. Therefore, the q-axis reference current may be set to 0 and may not change.

[0034] Optionally, when the d-axis reference current is greater than a preset current value, the d-axis reference current is set to the preset current value. The preset current value is used to represent the maximum allowable current value, and the d-axis reference current can be limited.

[0035] Step 404 , performing regulation processing based on the d-axis reference current and the first feedback current of the motor to obtain a first reference voltage.

[0036] The first reference voltage and the second reference voltage are reference voltages on the same coordinate system. For example, the first reference voltage is the a-axis reference voltage, and the second reference voltage is the b-axis reference voltage. Alternatively, the first reference voltage is the d-axis reference voltage, and the second reference voltage is the q-axis reference voltage.

[0037] Specifically, it can be understood that there is a conversion relationship between the dq coordinate system and the ab coordinate system. Therefore, the motor driver can adjust the process based on the d-axis reference current and the d-axis feedback current of the motor to obtain a first reference voltage. The motor driver can also determine the a-axis reference current based on the d-axis reference current, and adjust the process with the a-axis feedback current of the motor to obtain a first reference voltage, etc. That is, it is a current loop in the d-axis direction, so that the first feedback current approaches the current determined based on the d-axis reference current.

[0038] Step 406 , performing regulation processing based on the q-axis reference current and the second feedback current of the motor to obtain a second reference voltage.

[0039] Specifically, the motor driver can adjust the q-axis reference current and the q-axis feedback current of the motor to obtain the second reference voltage. The motor driver can also determine the b-axis reference current based on the q-axis reference current and the d-axis reference current, and adjust the b-axis feedback current of the motor to obtain the second reference voltage, etc. That is, it is a current loop in the q-axis direction, so that the second feedback current approaches the current determined based on the q-axis reference current.

[0040] It is understandable that the first reference voltage and the second reference voltage are both adjusted based on the actual feedback current of the motor, that is, how much voltage is required to make the feedback current of the motor reach the d-axis reference current. When the feedback current of the motor changes, the first reference voltage and the second reference voltage also change, thereby causing the d-axis reference current to change.

[0041] Step 408 : driving the motor to operate based on the first reference voltage and the second reference voltage.

[0042] Specifically, based on the first reference voltage and the second reference voltage, the on-off of the H-bridge is controlled by an SVPWM (Space Vector Pulse Width Modulation) module to drive the motor to operate.

[0043] The control method of the above-mentioned motor obtains the d-axis reference current by adjusting the difference between the bus voltage and the previous target voltage, and can determine the given current of the motor; and because the target voltage changes with the feedback current of the motor, the d-axis reference current is adjusted accordingly, so that the d-axis reference current decreases, and the voltage output by the current loop, that is, the target voltage, is within the bus voltage range, so that the feedback current of the motor can reach the reference current, and the current can be controlled, thereby avoiding current runaway and improving the motor control accuracy and performance.

[0044] In one embodiment, performing regulation processing based on the d-axis reference current and the first feedback current of the motor to obtain the first reference voltage includes:

[0045] Performing adjustment processing based on the d-axis reference current and the d-axis feedback current of the motor to obtain the d-axis reference voltage;

[0046] The second reference voltage is obtained by performing a regulation process based on the q-axis reference current and the second feedback current of the motor, including:

[0047] The q-axis reference voltage is obtained by adjusting the q-axis reference current and the q-axis feedback current of the motor;

[0048] The method drives a motor to operate based on a first reference voltage and a second reference voltage, comprising:

[0049] Obtaining an electrical angle determined based on a target speed of the motor;

[0050] Performing an inverse Park transform based on the d-axis reference voltage, the q-axis reference voltage, and the electrical angle to obtain the a-axis reference voltage and the b-axis reference voltage;

[0051] The motor is driven to operate based on the a-axis reference voltage and the b-axis reference voltage.

[0052] Among them, the inverse Park transform refers to the process of transforming variables in the dq coordinate system to the ab coordinate system.

[0053] Specifically, the direct feedback current of the motor can be the feedback current in the ab coordinate system, then the a-axis feedback current and the b-axis feedback current in the ab coordinate system are subjected to Park transformation, and the d-axis feedback current and the q-axis feedback current can be obtained. The motor driver performs proportional-integral adjustment processing based on the d-axis reference current and the d-axis feedback current of the motor to obtain the d-axis reference voltage; and performs proportional-integral adjustment processing based on the q-axis reference current and the q-axis feedback current of the motor to obtain the q-axis reference voltage.

[0054] The control methods of the motor include open-loop control and closed-loop control, and the open-loop control does not require the position sensor for position feedback. Therefore, the electrical angle of the motor can be determined based on the target speed of the motor. Then, based on the d-axis reference voltage and the q-axis reference voltage, and the electrical angle, the Park inverse transformation can be performed to obtain the a-axis reference voltage and the b-axis reference voltage. The motor driver inputs the a-axis reference voltage and the b-axis reference voltage into the SVPWM module for H-bridge on-off control to drive the motor to operate.

[0055] Ua ref =Ud ref *cosθ e -Uq ref *sinθ e

[0056] Ub ref =Ud ref *sinθ e +Uq ref *cosθ e

[0057] Among them, Ua ref is the a-axis reference voltage, Ub ref is the b-axis reference voltage, Ud ref is the d-axis reference voltage, Uq ref is the q-axis reference voltage, θ e The electrical angle.

[0058] In this embodiment, the d-axis reference voltage is obtained by adjusting the d-axis reference current and the d-axis feedback current, and the q-axis reference voltage is obtained by adjusting the q-axis reference current and the q-axis feedback current. The electrical angle of the motor is determined based on the target speed of the motor to determine the a-axis reference voltage and the b-axis reference voltage of the drive motor. There is no need for position sensor feedback to achieve open-loop control of the motor. In the open-loop control scenario, the d-axis reference current is controlled.

[0059] In one embodiment, the previous target voltage is obtained by taking the square root of the square of the previous d-axis reference voltage plus the square of the q-axis reference voltage.

[0060] Specifically, in theory

[0061] U d 2 +U q 2 =U target 2

[0062] Among them, U target Therefore, by adding the square of the previous d-axis reference voltage to the square of the q-axis reference voltage and taking the square root, a more accurate target voltage can be obtained.

[0063] In this embodiment, the previous target voltage is obtained by taking the square root of the previous d-axis reference voltage plus the square of the previous q-axis reference voltage, which can correctly reflect the voltage of a given motor, thereby obtaining a current within the controllable range of the bus voltage and improving the current control effect.

[0064] In one embodiment, performing regulation processing based on the d-axis reference current and the first feedback current of the motor to obtain the first reference voltage includes:

[0065] Performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain an a-axis reference current;

[0066] The a-axis reference voltage is obtained by adjusting the a-axis reference current and the a-axis feedback current of the motor;

[0067] The second reference voltage is obtained by performing a regulation process based on the q-axis reference current and the second feedback current of the motor, including:

[0068] Performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain a b-axis reference current;

[0069] The b-axis reference voltage is obtained by adjusting the b-axis reference current and the b-axis feedback current of the motor;

[0070] The method drives a motor to operate based on a first reference voltage and a second reference voltage, comprising:

[0071] The motor is driven to operate based on the a-axis reference voltage and the b-axis reference voltage.

[0072] Among them, the inverse Park transform refers to the process of transforming variables in the dq coordinate system to the ab coordinate system.

[0073] Specifically, the motor driver obtains an electrical angle θ determined based on the target speed of the motor. e An inverse Park transform is performed based on the d-axis reference current, the q-axis reference current and the electrical angle to obtain the a-axis reference current and the b-axis reference current.

[0074] Ia ref =Id ref *cosθ e -Iq ref *sinθ e

[0075] Ib ref =Id ref *sinθ e +Iq ref *cosθ e

[0076] The a-axis reference current and the b-axis reference current are AC with equal amplitude and 90° phase difference, so the PR controller is used for regulation. The motor driver performs PR regulation based on the a-axis reference current and the a-axis feedback current of the motor to obtain the a-axis reference voltage. The motor driver performs PR regulation based on the b-axis reference current and the b-axis feedback current of the motor to obtain the b-axis reference voltage. The motor driver inputs the a-axis reference voltage and the b-axis reference voltage into the SVPWM module for H-bridge on-off control to drive the motor to operate.

[0077] In this embodiment, the a-axis reference voltage and the b-axis reference voltage are used as the first reference voltage and the second reference voltage to determine the target voltage, and the currents on the a-axis and the b-axis are used as the feedback current to determine the given current of the motor.

[0078] In one embodiment, the previous target voltage is the maximum value of the previous a-axis reference voltage and the previous b-axis reference voltage;

[0079] Alternatively, the previous target voltage is obtained by taking the square root of the square of the previous a-axis reference voltage plus the square of the b-axis reference voltage.

[0080] Specifically, the current amplitudes in the ab-axis direction are substantially consistent, so the previous target voltage can directly take the maximum value of the previous a-axis reference voltage and the previous b-axis reference voltage.

[0081] In theory

[0082] U a 2 +U b 2 =U target 2

[0083] Among them, U target Therefore, by adding the square of the previous a-axis reference voltage to the square of the b-axis reference voltage and taking the square root, a more accurate target voltage can be obtained.

[0084] In this embodiment, the previous target voltage is the maximum value of the previous a-axis reference voltage and the previous b-axis reference voltage, or is obtained by taking the square root of the square of the previous a-axis reference voltage plus the square of the previous b-axis reference voltage. It can correctly reflect the voltage of a given motor, thereby obtaining a current within the controllable range of the bus voltage and improving the current control effect.

[0085] In one embodiment, the method further comprises:

[0086] Determine the A-axis feedforward voltage based on the motor speed, permanent magnet flux and electrical angle;

[0087] Determine the b-axis feedforward voltage based on the motor speed, permanent magnet flux and electrical angle;

[0088] Based on the a-axis reference current and the a-axis feedback current of the motor, the a-axis reference voltage is obtained by adjusting the current, including:

[0089] An adjustment process is performed based on the a-axis reference current and the a-axis feedback current of the motor, and the voltage obtained after the adjustment process is added to the a-axis feedforward voltage to obtain the a-axis reference voltage;

[0090] The b-axis reference voltage is obtained by adjusting the b-axis reference current and the b-axis feedback current of the motor, including:

[0091] The b-axis reference voltage is obtained by performing an adjustment process based on the b-axis reference current and the b-axis feedback current of the motor and adding the b-axis feedforward voltage to the voltage obtained after the adjustment process.

[0092] Specifically, the motor's A phase voltage U a and B phase voltage U b The expression is

[0093]

[0094] Among them, I a is the a-phase current, I b is the b-phase current, ω e is the target speed, is the permanent magnet flux, θ e is the electrical angle determined based on the target speed.

[0095] Take the last term of the above formula for feedforward compensation, then

[0096]

[0097] Ua ff is the a-axis feedforward voltage, Ub ff is the b-axis feedforward voltage.

[0098] Then add the voltage after PI regulation to the a-axis feedforward voltage to obtain the a-axis reference voltage Ua ref , add the voltage after PI regulation to the b-axis feedforward voltage Ub ff , get the b-axis reference voltage Ub ref The motor driver inputs the a-axis reference voltage and the b-axis reference voltage into the SVPWM module for H-bridge on-off control to drive the motor to operate.

[0099] In this embodiment, the a-axis feedforward voltage and the b-axis feedforward voltage are determined based on the motor speed, permanent magnet flux and electrical angle. That is, a portion of the voltage change is taken for feedforward compensation, thereby accelerating the voltage regulation in the a-axis and b-axis directions, so that the motor can run faster and more stably.

[0100] In one embodiment, the voltage loop proportional gain in the adjustment process of the difference between the bus voltage and the previous target voltage of the motor is

[0101]

[0102] The voltage loop integral gain is

[0103]

[0104] Where R is the resistance, ω is the voltage loop bandwidth, ω b is the current loop bandwidth, and L is the inductance.

[0105] Specifically, each of the dq phases has a current loop, and the voltage reference values ​​of the dq phases are calculated by setting the current reference values ​​of the d phase and the q phase.

[0106] From the d-phase and q-phase voltage equations

[0107]

[0108] U q is the q-axis voltage, I q is the q-axis current, L q is the q-axis inductance, U d is the d-axis voltage, I d is the d-axis current, L d is the d-axis inductance, ω e is the rotation speed.

[0109] Ignore the back EMF term and perform Laplace transformation for any phase

[0110] U(s)=R·I(s)+s·L·I(s)

[0111] Derived

[0112]

[0113] Considering the delay caused by software and hardware

[0114]

[0115] Design current loop structure

[0116] Taking the d-axis reference current as an example, the input is the d-axis reference current and the d-axis feedback current. The current loop PI controller expression is

[0117]

[0118] Among them, K cp is the current loop proportional gain, K ci is the current loop integral gain.

[0119] The above model calculates the open-loop transfer function and the closed-loop transfer function, and the current loop proportional gain can be known.

[0120] K cp =ω b L

[0121] Current loop integral gain

[0122] K ci =ω b R

[0123] Among them, ω bis the current loop bandwidth, R is the resistance, and L is the motor inductance.

[0124] As the motor speed increases, the voltage that the driver can output gradually reaches its limit (enters the weak magnetic range), which may cause the current to run away.

[0125] To this end, a voltage loop controller is added before the current loop to control the reference current. The voltage loop controller uses the bus voltage U dc As a reference value U ref , using the target voltage output by the current loop as the feedback value, calculate the d-axis reference current input to the current loop.

[0126] The difference between the bus voltage and the target voltage is input into the PI controller of the voltage loop to obtain the d-axis reference current.

[0127] Voltage loop controller expression

[0128]

[0129] Among them, k vp is the voltage loop proportional gain, k vi is the current loop proportional gain.

[0130] Then, simplify the current loop into a first-order system

[0131]

[0132] in

[0133]

[0134] T c is the current loop time constant; ε is the damping ratio, which is generally taken as 0.707 or 1; ω v is the current loop bandwidth.

[0135] Then, it can be simplified to the voltage loop open-loop model:

[0136]

[0137] s is the variable of the voltage loop open-loop model, L is the inductance of the motor, R represents the phase resistance of the motor,

[0138] in, is the transfer function of the PI controller, It is a first-order system simplified into the current loop.

[0139] The PI controller uses the zero-pole constant cancellation method,

[0140] k vp ·s+k vi = k(Tc ·s+1)

[0141] Right now

[0142] k vp = k·T c ;k vi =k

[0143] Then the voltage loop open-loop model is converted to:

[0144]

[0145] The voltage loop closed-loop model

[0146]

[0147] Derived

[0148]

[0149] The characteristic equation is

[0150]

[0151] According to the transfer function expression of the first-order system combined with the above formula, we can know that

[0152]

[0153] Then the voltage loop bandwidth ω

[0154]

[0155] Solved

[0156]

[0157] therefore

[0158]

[0159] In this embodiment, the accurate d-axis reference current can be determined by setting the proportional gain and the integral gain of the voltage loop.

[0160] In one embodiment, Figure 5 FIG. 1 is a flow chart of a method for controlling a motor in an embodiment. Figure 5 The first reference voltage is the d-axis reference voltage Ud_ref, the second reference voltage is the q-axis reference voltage Uq_ref, and the previous target voltage is the square root of the previous d-axis reference voltage Ud_ref plus the square of the previous q-axis reference voltage Uq_ref, that is, sqrt(Ud_ref 2 +Uq_ref 2). The first feedback current is the d-axis feedback current Id_fdb, and the second feedback current is the q-axis feedback current Iq_fdb. Figure 5 The a-axis reference voltage Ua_ref and the b-axis reference voltage Ub_ref ​​are also included. Take the above description as an example. Then based on the bus voltage Udc and the previous target voltage sqrt(Ud_ref 2 +Uq_ref 2 ) to obtain the d-axis reference current. Obtain the q-axis reference current, if the reference current is 0. Obtain the previous a-axis feedback current and the previous b-axis feedback current of the motor for park transformation, and determine the d-axis feedback current and the q-axis feedback current respectively. Perform PI adjustment based on the d-axis reference current and the d-axis feedback current of the motor to obtain the d-axis reference voltage. Perform PI adjustment based on the q-axis reference current and the q-axis feedback current of the motor to obtain the q-axis reference voltage. And the d-axis reference voltage and q-axis reference voltage of this time can be used to calculate the target voltage for the next time. Obtain the motor speed, determine the current electrical angle θe of the motor according to the motor speed, and perform park inverse transformation on the d-axis reference voltage and the q-axis reference voltage based on the electrical angle θe to obtain the a-axis reference voltage and the b-axis reference voltage. The a-axis reference voltage and the b-axis reference voltage are input into the SVPWM module to control the on and off of the H-bridge of phase A and phase B to drive the motor to run.

[0161] In this embodiment, when the position sensor is not used, the weak magnetic control is realized when the output voltage reaches the bus voltage by adjusting the current through the bus voltage, and the control performance of the stepper motor is improved by voltage feedforward compensation, especially the control performance at high speed. It has been proved through experiments that the voltage loop can adjust the current command after the output voltage of the driver reaches the set value, thereby reducing the current out of control and effectively improving the maximum speed.

[0162] In one embodiment, Figure 6 FIG. 1 is a flow chart of a method for controlling a motor in an embodiment. Figure 6 The first reference voltage is the a-axis reference voltage Ua_ref, the second reference voltage is the b-axis reference voltage Ub_ref, and the previous target voltage is the square root of the previous a-axis reference voltage Ua_ref plus the square of the previous b-axis reference voltage Ub_ref, that is, sqrt(Ua_ref 2 +Ub_ref 2 ). The first feedback current is the a-axis feedback current Ia_fdb, and the second feedback current is the b-axis feedback current Ib_fdb. Figure 6The d-axis reference current Id_ref, the q-axis reference current Iq_ref, the a-axis feedforward voltage Ua_ff and the b-axis feedforward voltage Ub_ff are also included. Take the above description as an example. Then based on the bus voltage Udc and the previous target voltage sqrt(Ua_ref 2 +Ub_ref 2 ) to perform PI adjustment to obtain the d-axis reference current. Obtain the q-axis reference current, if the reference current is 0. Obtain the motor speed, determine the current motor electrical angle θe according to the motor speed, and perform park inverse transformation on the d-axis reference current and the q-axis reference current based on the electrical angle θe to obtain the a-axis reference current and the b-axis reference current. Obtain the previous a-axis feedback current and the previous b-axis feedback current of the motor. Determine the a-axis feedforward voltage and the b-axis feedforward voltage based on the motor speed ωe, the electrical angle θ, and the flux Ψf. Perform PR adjustment based on the difference between the a-axis reference current and the a-axis feedback current, and add the a-axis voltage feedforward to obtain the a-axis reference voltage. Perform PR adjustment based on the difference between the b-axis reference current and the b-axis feedback current, and add the b-axis voltage feedforward to obtain the b-axis reference voltage. And the current a-axis reference voltage and b-axis reference voltage can be used to calculate the next target voltage. Input the a-axis reference voltage and the b-axis reference voltage into the SVPWM module to control the H-bridge on and off of phase A and phase B to drive the motor to run.

[0163] In this embodiment, when the position sensor is not used, the weak magnetic control is realized when the output voltage reaches the bus voltage by adjusting the current through the bus voltage, and the control performance of the stepper motor is improved by voltage feedforward compensation, especially the control performance at high speed. It has been proved through experiments that the voltage loop can adjust the current command after the output voltage of the driver reaches the set value, thereby reducing the current out of control and effectively improving the maximum speed.

[0164] In one embodiment, a method for controlling a motor includes:

[0165] Step (a1), adjusting processing is performed based on the difference between the bus voltage and the previous target voltage of the motor to obtain a d-axis reference current; the previous target voltage is obtained by taking the square root of the square of the previous d-axis reference voltage plus the square of the q-axis reference voltage.

[0166] Step (a2), performing adjustment processing based on the d-axis reference current and the d-axis feedback current of the motor to obtain the d-axis reference voltage.

[0167] Step (a3), performing regulation processing based on the q-axis reference current and the q-axis feedback current of the motor to obtain the q-axis reference voltage.

[0168] Step (a4), obtaining an electrical angle determined based on a target rotational speed of the motor.

[0169] Step (a5), performing an inverse Park transform based on the d-axis reference voltage, the q-axis reference voltage, and the electrical angle to obtain the a-axis reference voltage and the b-axis reference voltage.

[0170] Step (a6), driving the motor to operate based on the a-axis reference voltage and the b-axis reference voltage.

[0171] In this embodiment, the d-axis reference current is obtained by adjusting the difference between the bus voltage and the previous target voltage determined by the d-axis and q-axis reference voltages, so that the given current of the motor can be determined; and because the target voltage changes with the feedback current of the motor, the d-axis reference current is adjusted accordingly so that the d-axis reference current decreases, and the voltage output by the current loop, i.e., the target voltage, is within the bus voltage range, so that the feedback current of the motor can reach the reference current, thereby avoiding current runaway and improving the current control effect.

[0172] In one embodiment, a method for controlling a motor includes:

[0173] Step (b1), adjusting processing is performed based on the difference between the bus voltage and the previous target voltage of the motor to obtain the d-axis reference current; the previous target voltage is the maximum value of the previous a-axis reference voltage and the previous b-axis reference voltage; or, the previous target voltage is the square root of the square of the previous a-axis reference voltage plus the square of the b-axis reference voltage.

[0174] Step (b2), performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain the a-axis reference current.

[0175] Step (b3), performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain a b-axis reference current.

[0176] Step (b4), determining the A-axis feedforward voltage based on the motor speed, permanent magnet flux and electrical angle.

[0177] Step (b5), determining the b-axis feedforward voltage based on the motor speed, permanent magnet flux and electrical angle.

[0178] Step (b6), performing regulation processing based on the a-axis reference current and the a-axis feedback current of the motor, adding the voltage obtained after the regulation processing to the a-axis feedforward voltage to obtain the a-axis reference voltage.

[0179] Step (b7), performing regulation processing based on the b-axis reference current and the b-axis feedback current of the motor, adding the voltage obtained after the regulation processing to the b-axis feedforward voltage to obtain the b-axis reference voltage.

[0180] Step (b8), driving the motor to operate based on the a-axis reference voltage and the b-axis reference voltage.

[0181] In this embodiment, the d-axis reference current is obtained by adjusting the difference between the bus voltage and the previous target voltage determined by the a-axis and b-axis reference voltages, so that the given current of the motor can be determined; and because the target voltage changes with the feedback current of the motor, the d-axis reference current is adjusted accordingly so that the d-axis reference current decreases, and the voltage output by the current loop, i.e., the target voltage, is within the bus voltage range, so that the feedback current of the motor can reach the reference current, thereby avoiding current runaway and improving the current control effect.

[0182] It should be understood that although the above Figure 4 In the flowchart, each step is shown in sequence as indicated by the arrows, and each step in steps (a1) to (a6) and steps (b1) to (b8) is shown in sequence as indicated by the numbers, but these steps are not necessarily performed in the order indicated by the arrows or numbers. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be performed in other orders. Moreover, Figure 4 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0183] In one embodiment, a computer device is provided. The computer device may be a terminal device, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through Wi-Fi, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for controlling a motor is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the computer device housing, or an external keyboard, touch pad or mouse, etc.

[0184] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0185] In one embodiment, a motor driver includes a memory, a processor and a three-phase inverter. The memory stores a computer program. The processor implements the steps of the above method embodiments when executing the computer program. The three-phase inverter is used to drive the motor.

[0186] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.

[0187] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments are implemented.

[0188] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.

[0189] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes in the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0190] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for controlling a motor, characterized in that: The method comprises: Performing an adjustment process based on the difference between the bus voltage and the previous target voltage of the motor to obtain a d-axis reference current; the previous target voltage is determined based on the previous first reference voltage and the previous second reference voltage; Performing adjustment processing based on the d-axis reference current and the first feedback current of the motor to obtain a first reference voltage; Performing adjustment processing based on the q-axis reference current and the second feedback current of the motor to obtain a second reference voltage; The motor is driven to operate based on the first reference voltage and the second reference voltage.

2. The method according to claim 1, characterized in that The step of performing adjustment processing based on the d-axis reference current and the first feedback current of the motor to obtain a first reference voltage includes: Performing adjustment processing based on the d-axis reference current and the d-axis feedback current of the motor to obtain a d-axis reference voltage; The step of performing adjustment processing based on the q-axis reference current and the second feedback current of the motor to obtain the second reference voltage includes: Performing adjustment processing based on the q-axis reference current and the q-axis feedback current of the motor to obtain a q-axis reference voltage; The step of driving the motor to operate based on the first reference voltage and the second reference voltage includes: Acquiring an electrical angle determined based on a target rotation speed of the motor; Performing an inverse Park transform based on the d-axis reference voltage, the q-axis reference voltage, and the electrical angle to obtain an a-axis reference voltage and a b-axis reference voltage; The motor is driven to operate based on the a-axis reference voltage and the b-axis reference voltage.

3. The method according to claim 2, characterized in that The previous target voltage is obtained by taking the square root of the square of the previous d-axis reference voltage plus the square of the previous q-axis reference voltage.

4. The method according to claim 1, characterized in that: The step of performing adjustment processing based on the d-axis reference current and the first feedback current of the motor to obtain a first reference voltage includes: Performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain an a-axis reference current; Performing adjustment processing based on the a-axis reference current and the a-axis feedback current of the motor to obtain an a-axis reference voltage; The step of performing adjustment processing based on the q-axis reference current and the second feedback current of the motor to obtain the second reference voltage includes: Performing an inverse Park transform based on the d-axis reference current and the q-axis reference current to obtain a b-axis reference current; Performing adjustment processing based on the b-axis reference current and the b-axis feedback current of the motor to obtain a b-axis reference voltage; The step of driving the motor to operate based on the first reference voltage and the second reference voltage includes: The motor is driven to operate based on the a-axis reference voltage and the b-axis reference voltage.

5. The method according to claim 4, characterized in that The previous target voltage is the maximum value of the previous a-axis reference voltage and the previous b-axis reference voltage; Alternatively, the previous target voltage is obtained by taking the square root of the square of the previous a-axis reference voltage plus the square of the previous b-axis reference voltage.

6. The method according to claim 4, characterized in that The method further comprises: Determine the A-axis feedforward voltage based on the motor speed, permanent magnet flux and electrical angle; Determining a b-axis feedforward voltage based on the motor speed, the permanent magnet flux and the electrical angle; The step of performing adjustment processing based on the a-axis reference current and the a-axis feedback current of the motor to obtain the a-axis reference voltage includes: Performing an adjustment process based on the a-axis reference current and the a-axis feedback current of the motor, adding the a-axis feedforward voltage to the voltage obtained after the adjustment process to obtain the a-axis reference voltage; The step of performing adjustment processing based on the b-axis reference current and the b-axis feedback current of the motor to obtain the b-axis reference voltage includes: An adjustment process is performed based on the b-axis reference current and the b-axis feedback current of the motor, and the voltage obtained after the adjustment process is added to the b-axis feedforward voltage to obtain the b-axis reference voltage.

7. The method according to any one of claims 1 to 6, characterized in that: The voltage loop proportional gain in the adjustment process of the difference between the bus voltage and the previous target voltage of the motor is The voltage loop integral gain is Where R is the resistance, ω is the voltage loop bandwidth, ω b is the current loop bandwidth, L is the inductance, and ε is the damping ratio.

8. A motor driver, characterized in that: The motor driver is used to implement the steps of the method according to any one of claims 1 to 7.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.