Double-closed-loop vector control method for two-phase hybrid stepping motor
By adopting a dual closed-loop vector control method in a two-phase hybrid stepper motor, combined with magnetic encoder and phase current sampling technology, the vector accurate control of the stepper motor is achieved, solving the problems of step loss and motor heating in the existing technology, and improving the performance and control accuracy of the motor.
Patent Information
- Application Number
- CN202411982417.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing stepper motor control technology lacks real-time monitoring of the motor rotor, which leads to easy step loss in case of overload or pulse interference, and cannot meet the application needs of high-precision and fast response.
The dual closed-loop vector control method of a two-phase hybrid stepper motor is used to detect the rotor position and current through a magnetic encoder and phase current sampling circuit, and the position ring, speed ring and current ring closed-loop control is constructed, and the improved two-phase SVPWM is output to the dual H-bridge inverter drive circuit to achieve accurate vector control.
Accurate vector control of stepper motors is achieved, the tracking performance and current utilization of the motor are improved, the heating of the motor is reduced, and the real-time monitoring and control capabilities of the motor are enhanced.
Smart Images

Figure CN119813871A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of stepper motor control methods, and in particular to a double closed-loop vector control method for a two-phase hybrid stepper motor. Background Art
[0002] A stepper motor is an electric motor that can convert an electrical pulse signal into a corresponding angular displacement or linear displacement. The basic working principle of a stepper motor is to generate electromagnetic torque by relying on the change of air gap magnetic permeability. When the windings of the stator are energized in a specific order, a magnetic field that changes along the axial direction of the stator winding is generated. The magnetic field interacts with the magnetic poles of the rotor and drives the rotor to rotate at a fixed step angle. For each input pulse signal, the rotor rotates an angle and moves forward one step. The angular displacement or linear displacement output by the stepper motor is proportional to the number of input pulses, and the speed is proportional to the pulse frequency. If the order in which the windings are energized is changed, the motor will reverse.
[0003] At present, the traditional control technology of stepper motors is mainly based on open loop. Due to its advantages of simple control, low cost and easy implementation, it is often used in industrial automation, CNC machine tools, household appliances and other fields. However, under this control mode, there is a lack of real-time monitoring of the motor rotor. If the motor is overloaded or the pulse signal is interfered during operation, the stepper motor will lose steps. It cannot meet the application scenarios with high precision requirements and fast response speed. It is necessary to introduce closed-loop control to improve the tracking performance of the stepper motor. The existing closed-loop control stepper motors are mostly position closed-loop and torque open-loop control modes, lacking feedback control of current, and have problems such as low current utilization, unstable torque, and severe motor heating.
[0004] As shown in the Chinese invention patent application with patent announcement number CN106961233A, a closed-loop vector control scheme for a two-phase hybrid stepper motor based on fuzzy control is disclosed. Fuzzy control improves the adaptability and application range of the control system. However, compared with the PID controller, fuzzy control is more difficult to debug and is highly dependent on the debugging experience of the debugger, which is not conducive to subsequent maintenance work. It also has high performance requirements for the controller, which is not conducive to controlling costs.
[0005] As shown in the Chinese invention patent application with patent announcement number CN113067509A, a two-stage series control method using a position closed loop and a torque open loop is disclosed. The advantage of this technical solution is that it is simple to implement and has low cost, but its disadvantage is that it lacks closed-loop feedback control of the current, resulting in low current utilization of the stepper motor, unstable output torque, and severe motor heating. Summary of the invention
[0006] In view of the deficiencies in the prior art, an object of the present invention is to provide a dual closed-loop vector control method for a two-phase hybrid stepping motor to achieve precise vector control of the stepping motor.
[0007] In order to achieve the above-mentioned purpose, the technical scheme adopted by the present invention is: a dual closed-loop vector control method of a two-phase hybrid stepping motor, the two-phase hybrid stepping motor is composed of a stator with a plurality of tooth slots arranged according to a set rule and a rotor with an axially magnetized embedded permanent magnet, and the two-phase hybrid stepping motor is structurally realized to realize dual closed-loop control of position and current through detection of current and rotor position and negative feedback control, including the following steps:
[0008] Step S1: Obtain pulse increments through a trajectory generator set in an external control card or a trajectory generator set inside a stepper motor driver, and convert the pulse increments into target positions to obtain the target position Pos of the position loop. Ref (k);
[0009] Step S2: After the signal of the magnetic encoder is processed by electrical angle conversion and position feedback conversion, the feedback position Pos of the motor rotor is obtained. fb (k), set the target position Pos Ref (k) and feedback position Pos fb (k) is input into the position loop controller after subtraction, and the output is the target speed Spd Ref (k);
[0010] Step S3: Set the electrical angle θ k After speed feedback conversion processing, the speed feedback Spd is obtained fb (k), the target speed Spd Ref (k) and speed feedback Spd fb (k) is input into the speed loop controller after subtraction, and the target current of the quadrature axis is obtained as output. and the target current of the direct axis
[0011] Step S4: The currents of the α and β axes are obtained by sampling and filtering the A and B phase currents of the two-phase hybrid stepping motor, and the quadrature axis current I is obtained by performing Park transformation on the obtained α and β axis currents. q and the direct axis current I d , the quadrature axis target current With the quadrature axis current I q Differential, direct axis target current With direct axis current I d The difference is then input into the current loop controller to obtain the quadrature axis output voltage U acting on the quadrature axis. q And the direct axis output voltage U acting on the direct axisd ; The expression of Parker transformation is,
[0012] I q =I β *cos(θ k )-I α *sin(θ k )
[0013] I d =I α *cos(θ k )+I β *sin(θ k )
[0014] Step S5: Output voltage U of the quadrature axis q With direct axis output voltage U d Perform the inverse Park transform to obtain the voltage vector component U that needs to be output to the α-axis in the current loop cycle. α And the voltage vector component U output to the β axis β ; Quadrature axis output voltage U q With direct axis output voltage U d After the inverse Park transformation, the voltage vector component U that needs to be output to the α and β axes in the current loop cycle is obtained. α with U β , the expression of Parker's inverse transform is,
[0015] U α =U d *cos(θ k )-U q *sin(θ k )
[0016] U β =U d *sin(θ k )+U q *cos(θ k )
[0017] Step S6: Obtain the voltage vector component U to be output to the α and β axes through step S5 α with U β , respectively for U α with U β The positive and negative directions of the vector direction are judged, and the expected voltage vector U is obtained. Ref In the sector where it is located, a two-phase SVPWM drive signal is generated and the corresponding four-way PWM drive signal is output to the dual H-bridge inverter drive circuit, so that the motor stator of the two-phase hybrid stepper motor generates a magnetic field consistent with the direction of the voltage synthesis vector and controls the rotor to rotate in the vector direction, so as to realize vector control of the two-phase hybrid stepper motor.
[0018] In a further technical solution, the step S6: generating the two-phase SVPWM drive signal to realize vector control of the two-phase hybrid stepping motor, step S6 includes the following sub-steps:
[0019] S6.1: Obtain the voltage vector component U to be output to the α and β axes through step S5 α with U β , respectively for the voltage vector component U α with U β The positive and negative directions of the vector direction are judged to obtain the expected voltage vector U Ref The sector where the judgment is made is as follows:
[0020] When U α >0,U β >0, the expected voltage vector U Ref In sector I,
[0021] When U α <=0,U β >0, the expected voltage vector U Ref In sector II,
[0022] When U α <=0,U β <=0, the expected voltage vector U Ref Located in sector III,
[0023] When U α >0,U β <=0, the expected voltage vector U Ref Located in sector IV;
[0024] S6.2: The bus voltage U can be obtained through the bus voltage sampling circuit DC The current loop cycle frequency is 20KHz, and the voltage vector component U is obtained by using the volt-second balance principle. α with U β In a current loop period T pwm The time T that acts on the α axis and the β axis respectively α With T β , the expression is,
[0025]
[0026]
[0027] Among them, T α With T β is the voltage vector U α with U βThe time taken by the current acting on the α-axis and the β-axis in one current loop cycle, |U α |with|U β | is the voltage vector U on the α and β axes α with U β Take the absolute value, U DC is the bus voltage, T Pwm is a current loop cycle time;
[0028] S6.3: According to the expected voltage vector U Ref The sector and the calculated T α With T β , distribute and adjust the positive duty cycle time of the four-way PWM drive signal output to the dual H-bridge inverter drive circuit in one current loop cycle, the PWM drive signal adjusts the duty cycle time of each cycle in a center-aligned manner, and applies the two-phase four-wire drive signal to the two-phase hybrid stepper motor, so that the motor stator generates a magnetic field consistent with the voltage vector synthesis direction to control the rotor to rotate to the desired voltage vector U Ref In the vector direction, to achieve vector control of the two-phase hybrid stepper motor,
[0029] The four PWM drive signals are PWMA signal, PWMB signal, PWMC signal and PWMD signal.
[0030] When the expected voltage vector U Ref When in sector I, the positive duty cycle time of the PWMA signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMB signal and the PWMD signal outputs maintain a low level output in the current current loop cycle;
[0031] When the expected voltage vector U Ref When in sector II, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMA signal and the PWMD signal outputs maintain a low level output in the current current loop cycle;
[0032] When the expected voltage vector U Ref When in sector III, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMD signal is T β , the PWMA signal and the PWMC signal outputs maintain a low level output in the current current loop cycle;
[0033] When the expected voltage vector U Ref When in sector IV, the positive duty cycle time of the PWMA signal is Tα , the positive duty cycle time of the PWMD signal is T β , the PWMB signal and the PWMC signal outputs maintain a low level output in the current current loop cycle;
[0034] S6.4: According to the allocated four-way PWM positive duty cycle time and dead time, and combined with the necessary zero vector time T0, the motor driver outputs the corresponding four-way PWM drive signal to the dual H-bridge inverter drive circuit, and the desired voltage vector U is obtained. Ref ,
[0035] Among them, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop period T pwm The time taken up in .
[0036] In a further technical solution, the step S5: after completing the voltage vector component U α with U β After calculation, the voltage vector component U α with U β Limiting is performed to prevent the desired voltage vector U from being synthesized. Ref appears greater than the bus voltage U DC , to avoid motor loss of control due to over-modulation, and to constrain the spatial voltage vector amplitude of the current loop output. The voltage vector component U α with U β The following constraints must be met, and the expression is:
[0037]
[0038] When the constraints are exceeded, a new voltage vector needs to be given, and the expression is:
[0039]
[0040] in, and A new voltage vector is given under the constraints;
[0041] When a new voltage vector is given in step S5, in the sub-step S6.2, due to the need for phase current sampling time, it is necessary to retain the necessary zero vector time T0 required for phase current sampling in one current loop cycle, so it is necessary to adjust T α With T β Constrain and set the voltage vector component U α with U β The maximum time T acting in one current loop cycle max , if T α or T β Exceeding the maximum time T maxConstraints, then we need to re-given U α or U β The action time is expressed as,
[0042]
[0043] in, and After exceeding the constraint, the voltage vector component U is re-given α with U β The acting time in one current loop cycle.
[0044] In a further technical solution, in step S1, the position loop receives pulse signals and accumulates them to obtain the target position Pos of the position loop. Ref (k), the trajectory generator is provided inside the external control card and the stepper motor driver, the trajectory generator uses a trapezoidal curve acceleration and deceleration algorithm to design the trajectory, the frequency of pulse signal generation is controlled by the trajectory generator, and the bus pulse or motion control parameter is sent to the stepper motor driver by RS-422 bus connection;
[0045] In step S6, the dual H-bridge inverter drive circuit is input with four PWM signals, which respectively control the conduction and closing of the upper and lower half bridges at both ends of the H-bridge of the A phase and the B phase of the motor to control the voltage output of the A phase and the B phase;
[0046] In the sub-step S6.3, in one current loop cycle, two PWM signals are output to both ends of the H bridge, one PWM signal controls the on and off time of the upper and lower half bridges on one side of the H bridge, and the other PWM signal maintains a low level output to maintain the on of the lower half bridge on the other side of the H bridge. Dead time is added during the on and off switching of the upper and lower half bridges to avoid short circuit caused by the upper and lower half bridges being on at the same time;
[0047] The vector control of the two-phase hybrid stepper motor refers to using the space voltage vectors on the α-axis and the β-axis as the basis vector to synthesize a vector of any angle. In each sector, two adjacent voltage vectors and the zero vector U0 are selected to synthesize any voltage vector in each sector according to the volt-second balance principle. The expression is:
[0048]
[0049] The above expression is discretized to be equivalent to:
[0050] U Ref *T pwm =U α *T α +U β *T β +U0*T0,
[0051] Among them, the vector voltage U α With vector voltage U β Independent of each other, vector voltage U α With vector voltage U β Acting on two-phase coils at the same time, U Ref is the voltage vector we expect, T pwm is a current loop cycle time, T α With T β is the vector voltage U α with U β In a current loop period T pwm The time occupied by the zero vector U0 acting on the α axis and the β axis respectively, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop cycle T pwm The time taken up in
[0052] The duty ratios of the α-axis and the β-axis in one current loop cycle are configured to synthesize an equivalent space voltage vector of any angle and realize vector control.
[0053] In a further technical solution, in step S1, the trajectory generator adopts a trapezoidal curve acceleration and deceleration algorithm, and the trapezoidal curve acceleration and deceleration algorithm uses the same acceleration in the acceleration process and the deceleration process. Step S1 includes the following sub-steps:
[0054] S1.1: The three parameters of target acceleration accel, target speed speed and target stroke step set by the user are transmitted to the trajectory generator of the external control card or the trajectory generator inside the stepper motor driver, and the pulse increment Pulse of the kth position loop period is calculated by the trajectory generator inc (k);
[0055] S1.2: The stepper motor driver receives the pulse increment Pulse inc (k), and the k-1th position loop period T Pos The total number of pulses Pulse(k-1) of the kth position loop cycle is added to obtain the total number of pulses Pulse(k) of the kth position loop cycle. The calculation expression is:
[0056] Pulse(k)=Pulse(k-1)+Pulse inc (k);
[0057] S1.3: The total number of pulses PulSe(k) is rotated by the electronic gear inside the stepper motor driver to obtain the target position Pos of the kth position loop cycle Ref (k), the calculation expression is:
[0058]
[0059] Among them, Pos Ref (k) is the target position of the kth position loop cycle, Pulse(k) is the total number of pulses in the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom It is the denominator coefficient of the electronic gear.
[0060] In a further technical solution, in step S1.1, the stepper motor driver uses RS-422 bus reception combined with the internal trajectory generator to obtain the pulse increment, combined with the position loop position loop period T Pos Generate the pulse increment of the current cycle of the trapezoidal acceleration and deceleration curve;
[0061] The trajectory generator is based on the position loop period T Pos is a fixed period, calculate each position loop period T Pos The pulse increment will be generated within a certain time. This calculation process discretizes the continuous calculation process of trapezoidal curve acceleration and deceleration into a position loop period T Pos The discrete calculation process of the iterative cycle is used to find the number of pulses generated by the trapezoidal acceleration and deceleration curve in each iterative process, which is the pulse increment of the position loop cycle.
[0062] Set the position loop period frequency f Pos Set to 2KHz, position loop cycle time T Pos Set to 500μs; set the speed loop period frequency f Spd Set to 10KHz, speed loop cycle time T Spd Set to 100μs; set the current loop cycle frequency f pwm Set to 20KHz, current loop cycle time T pwm Set to 50μs.
[0063] In a further technical solution, the sub-step S1.1, the trajectory generator includes five working stages in the trapezoidal curve acceleration and deceleration algorithm, namely, an idle stage, a preparation stage, an acceleration stage, a uniform speed stage and a deceleration stage, and the sub-step S1.1 includes the following sub-steps:
[0064] S1.1.1: Idle stage, the three motion parameters of the target acceleration accel, the target speed speed and the target stroke step acquired by the stepper motor driver are transmitted to the trajectory generator, and the trajectory generator enters the preparation stage from the idle stage;
[0065] S1.1.2: Preparation stage, to prepare for the algorithm work, first clear all the algorithm process variables, and then calculate the parameters that will not participate in the algorithm iteration in the subsequent iteration cycle, so as to reduce the amount of calculation in the algorithm cycle iteration process and improve the operation efficiency;
[0066] S1.1.3: Acceleration phase, the algorithm starts to iteratively calculate each position loop period T in the acceleration phase Pos The pulse increment of the acceleration phase is accumulated and counted. The pulse increment output is based on Pulse inc The integer part of (k) is used as the output. The number of pulses can only be an integer without decimals. To avoid the problem of pulse shortage or overflow caused by the existing decimals being ignored, iterate to num in the acceleration stage. accel_end When the number of steps is calculated, the number of pulses generated during the acceleration phase is Pulse accel (k) Perform statistics and calculate the pulse compensation coefficient Comp_k to perform pulse compensation in the uniform speed stage and the deceleration stage;
[0067] S1.1.4: Uniform speed stage: judge whether there will be a uniform speed stage in this movement according to the calculation results of the preparation stage. If there is a uniform speed stage, calculate the pulse increment of each iteration cycle of the uniform speed stage, and compensate the pulse increment according to the compensation coefficient Comp_k. If there is no uniform speed stage, jump directly to the deceleration stage for execution;
[0068] S1.1.5: In the deceleration phase, in order to make the trajectory generator better meet the target stroke step pulse number requirements and to reduce the amount of pulse compensation calculation and predictability, the acceleration phase index is reversed to ensure that the number of pulses generated in the acceleration phase is consistent with that in the deceleration phase.
[0069] In a further technical solution, the sub-step S1.1.2, the preparation phase workflow includes the following sub-steps:
[0070] S1.1.2.1: Determine whether the input target acceleration accel, target speed speed and target travel step are 0. If so, return to the idle stage and exit the trajectory generator; otherwise, clear all process variables of the algorithm;
[0071] S1.1.2.2: If the target stroke step is 1, then the output pulse increment Pulse inc (k) = 1, and return to the idle phase and exit the trajectory generator, otherwise continue to execute sub-step S1.1.2.3;
[0072] S1.1.2.3: Calculate the acceleration time accel and the uniform speed phase time uniform, the calculation expression is:
[0073] time accel =speed / accel,
[0074] time uniform =step / speed-time accel ;
[0075] S1.1.2.4: If time uniform <0, it is judged that this trapezoidal acceleration and deceleration motion has no uniform speed stage, that is, this motion cannot reach the set target speed, and the acceleration stage time is calculated. accel and the uniform speed phase time uniform Need to recalculate, the calculation expression is:
[0076]
[0077] time uniform =0,
[0078] Otherwise, continue directly to execute sub-step S1.1.2.5;
[0079] S1.1.2.5: Calculate the intermediate variable of the pulse increment during the acceleration phase. The expression is:
[0080]
[0081] Calculate the pulse increment of each position loop cycle in the uniform speed stage. The expression is:
[0082] Pulse uniform =speed*T Pos ;
[0083] Calculate the number of iterations at the end of the acceleration phase, the expression is:
[0084] num accel_end =time accel / T Pos ;
[0085] Calculate the number of iterations at the start of the deceleration phase using the expression:
[0086] num decel_start =num accel_end +time uniform / T Pos ;
[0087] Calculate the number of iterations at the end of the deceleration phase, the expression is:
[0088] num decel_end =num decel_start+num accel_end ,
[0089] According to the nature of the trapezoidal acceleration / deceleration curve and the principle of using the same acceleration in the acceleration and deceleration stages, the number of iteration steps in the acceleration and deceleration stages is the same;
[0090] Calculate the number of iterations in the uniform velocity phase. The expression is:
[0091] num uniform =num decel_start -num accel_end ;
[0092] The sub-step S1.1.3, the acceleration phase workflow includes the following sub-steps,
[0093] S1.1.3.1: Initialize the number of iterations num index =0, pulse increment intermediate variable temp inc (k) = 0, pulse compensation quantity statistics Pulse comp (k) = 0, pulse increment Pulse inc (k) = 0, the pulse increment Pulse in the acceleration phase accsl (k) = 0, pulse compensation number Pulse diff =0, pulse compensation coefficient Comp_k = 0, intermediate variable temP of pulse compensation comp =0;
[0094] S1.1.3.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is:
[0095] temp inc (k) = temp inc (k-1)+(num index +0.5)*temp accel ;
[0096] S1.1.3.3: If temp inc (k)>=1 or temp inc (k)<=-1,
[0097] Then for the intermediate variable temp inc (k) Round off to get the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0098] Pulse inc (k)=[temp inc(k)],
[0099] temp inc (k) = temp inc (k)-Pulse inc (k)
[0100] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0101] S1.1.3.4: Pulse increment during the cumulative acceleration phase accel (k), the expression is:
[0102] Pulse accel (k) = Pulse accel (k-1)+Pulse inc (k);
[0103] S1.1.3.5: If the number of iterations num index = = (num accel_end -1),
[0104] Then calculate the pulse compensation quantity Pulse diff And the pulse compensation coefficient Comp_k, the expression is:
[0105] Pulse diff =step-(2*Pulse accel (k)+num uniform *Pulse uniform ), Comp_k=Pulse diff / (num decel_end -num accel_end );
[0106] Otherwise, continue with sub-step S1.1.3.6;
[0107] S1.1.3.6: Output the calculated pulse increment of the current iteration cycle inc (k), and the number of iteration steps num index Going one step further, the expression is: num index =num index +1;
[0108] S1.1.3.7: If the number of iterations num index <num accel_end , then in the next iteration cycle, return to sub-step S1.1.3.2 and continue execution;
[0109] Otherwise, the pulse increments the intermediate variable temp inc(k) Clear, i.e. temp inc (k) = 0, the trajectory generator enters the uniform speed stage and executes S1.1.4 to perform the next iteration cycle;
[0110] The sub-step S1.1.4, the uniform speed phase workflow includes the following sub-steps:
[0111] S1.1.4.1: If the number of iterations num index <num decel_start , then continue to execute step sub-step S1.1.4.2; otherwise, the pulse increment intermediate variable temp inc (k) Clear, i.e. temp inc (k) = 0, and jump to the deceleration phase of the trajectory generator and execute sub-step S1.1.5;
[0112] S1.1.4.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is:
[0113] temp inc (k) = temp inc (k-1)+Pulse uniform ;
[0114] S1.1.4.3: If temp inc (k)>=1 or temp inc (k)<=-1,
[0115] Then for the intermediate variable temp inc (k) Round the output pulse increment of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0116] Pulse inc (k)=[temp inc (k)],
[0117] temp inc (k) = temp inc (k)-Pulse inc (k);
[0118] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0119] S1.1.4.4: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc(k) Perform pulse compensation and count the number of compensated pulses. The expression is as follows:
[0120] temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1)
[0121] Pulse comp (k) = Pulse comp (k-1)+temp comp ,
[0122] Pulse inc (k) = Pulse inc (k)+temp comp ;
[0123] S1.1.4.5: The pulse increment Pulse calculated in this iteration cycle inc (k) Output, number of iteration steps num index Step one step further, the expression is num index =num index +1, and return to sub-step S1.1.4.1 to continue execution in the next iteration cycle;
[0124] The sub-step S1.1.5, the workflow of the deceleration stage further includes the following sub-steps,
[0125] S1.1.5.1: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is:
[0126] temp inc (k)=temP inc (k-1)+(num accel_end -(num index -num decel_start )-0.5)*temp accel ;
[0127] S1.1.5.2: If te```p inc (k)>=1 or temp inc (k)<=-1,
[0128] Then for the intermediate variable temp inc (k) Round the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0129] Pulse inc (k)=[temp inc (k)],
[0130] temp inc (k) = temp inc (k)-Pulse inc (k);
[0131] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0132] S1.1.5.3: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc (k) Perform pulse compensation and count the number of compensated pulses. The expression is:
[0133] temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1),
[0134] Pulse comp (k) = Pulse comp (k-1)+temp comp ,
[0135] Pulse inc (k) = Pulse inc (k)+temp comp ;
[0136] S1.1.5.4: The pulse increment Pulse calculated in this iteration cycle inc (k) Output and iterate the number of steps num index Step forward, num index =num index +1;
[0137] S1.1.5.5: If the number of iterations num index <num decel_end , then in the next iteration cycle, return to step S1.1.5.1 to continue execution;
[0138] Otherwise, the iteration ends and the trajectory generator returns to the idle state, waiting for the input of subsequent control instructions.
[0139] In a further technical solution, in step S2, the magnetic encoder obtains the feedback position Pos of the motor rotor after electrical angle conversion and position feedback conversion processing. fb(k), set the target position Pos Ref (k) and feedback position Pos fb (k) After the difference is made, it is input into the position loop controller and output to obtain the target speed Spd Ref (k), step S2 includes the following sub-steps:
[0140] S2.1: Get the original position data of the motor rotor from the magnetic encoder, and convert it into an electrical angle to get the electrical angle θ of the kth position loop period. k ;
[0141] S2.2: Electrical angle θ k After the electronic gear conversion, the position feedback Pos of the k-1th position loop cycle is obtained. fb (k-1) is added to get the position feedback Pos of the kth position loop cycle fb (k), the expression is:
[0142]
[0143] Among them, Pos fb (k) is the position feedback of the kth position loop cycle, θ k is the electrical angle of the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom is the denominator coefficient of the electronic gear;
[0144] S2.3: Target position Pos Ref (k) and position feedback Pos fb (k) After subtraction, the position error Pos of the kth position loop cycle is obtained. Err (k), the expression is:
[0145] Pos Err (k)=Pos Ref (k)-Pos fb (k)
[0146] Among them, Pos Err (k) is the position error of the kth position loop cycle, Pos Ref (k) is the target position of the kth position loop cycle, Pos fb (k) is the position feedback of the kth position loop cycle;
[0147] S2.4: Set the position error Pos Err (k) is input to the position loop controller, and the feedforward control is combined with the proportional control to output the target speed Spd of the kth speed loop cycle. Ref (k), the expression is:
[0148]
[0149] Among them, Spd Ref (k) is the target speed of the kth speed loop cycle, is the proportional coefficient of the position loop, Pos Err (k) is the position error of the kth position loop cycle, Comp Pos is the feedforward compensation coefficient of the position loop, Pos Ref (k) is the target position of the kth position loop cycle.
[0150] In a further technical solution, in step S3, the electrical angle θ k After speed feedback conversion processing, the speed feedback Spd is obtained fb (k), the target speed Spd Ref (k) and speed feedback Spd fb (k) is input into the speed loop controller after subtraction, and the target current of the quadrature axis is obtained as output. Step S3 includes the following sub-steps,
[0151] S3.1: The electrical angle θ obtained in step S2.1 k Data, and also as the electrical angle θ of the kth speed loop cycle k , used to obtain the speed feedback Spd of the kth speed loop cycle fb (k), the expression is:
[0152]
[0153] Among them, Spd fb (k) is the speed feedback of the kth speed loop cycle, θ k is the electrical angle of the kth speed loop cycle, Spd max is the maximum speed of the motor, Enc max The maximum range of the magnetic encoder sampling;
[0154] S3.2: The target speed Spd obtained in step S2.4 is Ref (k) and speed feedback value Spd fb (k) is subtracted to obtain the speed error Spd of the kth speed loop cycle Err (k), the expression is:
[0155] Sd Err (k) = Spd Ref (k)-Spd fb (k)
[0156] Among them, Spd Err(k) is the speed error of the kth speed loop cycle, Spd Ref (k) is the target speed of the kth speed loop cycle, Spd fb (k) is the speed feedback of the kth speed loop cycle;
[0157] S3.3: Set the speed error Spd Err (k) is input to the speed loop controller, and after the feedforward control and proportional integral control are combined, the target current of the quadrature axis is output. The expression is:
[0158]
[0159] in, is the target current of the quadrature axis, is the proportional coefficient of the speed loop controller, is the integral coefficient of the speed loop controller, Spd Err (k) is the speed error of the kth speed loop cycle, Comp Spd is the feedforward compensation coefficient of the speed loop, Spd Ref (k) is the target speed of the kth speed loop cycle.
[0160] Compared with the prior art, the advantages of the present invention are as follows: the present invention adopts a magnetic encoder and a phase current sampling circuit to obtain the rotor position and two-phase current data of the stepper motor, constructs a position loop, a speed loop and a current loop closed-loop control in the software, and finally outputs the improved two-phase SVPWM to a dual H-bridge inverter drive circuit to achieve precise vector control of the stepper motor.
[0161] The present invention realizes the detection and negative feedback control of current and rotor position, and improves the vector control technology originally used to drive the DC brushless motor so as to be better applied to the two-phase hybrid stepping motor, thereby realizing the position and current double closed-loop control of the two-phase hybrid stepping motor from the structural point of view. BRIEF DESCRIPTION OF THE DRAWINGS
[0162] Figure 1 It is a vector diagram of a two-phase hybrid stepping motor of the present invention.
[0163] Figure 2 It is a circuit schematic diagram of the present invention driven by dual H-bridge inverter.
[0164] Figure 3 The present invention is a flowchart of the double closed-loop vector control method of the two-phase hybrid stepping motor.
[0165] Figure 4 It is an overall structural block diagram of the double closed-loop vector control method of the two-phase hybrid stepping motor of the present invention.
[0166] Figure 5 It is a workflow diagram of the preparation phase of the trajectory generator of the present invention.
[0167] Figure 6 It is a workflow diagram of the acceleration phase of the trajectory generator of the present invention.
[0168] Figure 7 It is a workflow diagram of the uniform speed stage of the trajectory generator of the present invention.
[0169] Figure 8 It is a workflow diagram of the deceleration phase of the trajectory generator of the present invention.
[0170] Fig. 9 It is the vector synthesis diagram and waveform diagram of the I sector of the present invention.
[0171] Fig.10 It is the vector synthesis diagram and waveform diagram of sector II of the present invention.
[0172] Fig.11 It is the vector synthesis diagram and waveform diagram of sector III of the present invention.
[0173] Fig.12 It is the vector synthesis diagram and waveform diagram of the IV sector of the present invention. DETAILED DESCRIPTION
[0174] A dual closed-loop vector control method for a two-phase hybrid stepping motor. Figures 1 to 12 As shown, the following steps are included:
[0175] The two-phase hybrid stepping motor of the present invention is composed of a stator with a plurality of tooth slots arranged according to a set rule and a rotor with an axially magnetized embedded permanent magnet, which realizes the detection and negative feedback control of current and rotor position. Figure 3 and 4 As shown, the position and current double closed-loop control is realized for the two-phase hybrid stepping motor from the structural point of view, including steps S1-S6,
[0176] Step S1: Obtain pulse increments through a trajectory generator set in an external control card or a trajectory generator set inside a stepper motor driver, and convert the pulse increments into target positions to obtain the target position Pos of the position loop. Ref (k).
[0177] In step S1, the position loop controls the received pulse signal and accumulates it to obtain the target position Pos of the position loop. Ref(k) A trajectory generator is provided inside both the external control card and the stepper motor driver. In addition, considering that there is no need to use different acceleration and deceleration speeds in the actual use of the present invention, and in order to further reduce the computational overhead of the trapezoidal curve acceleration and deceleration algorithm, the same acceleration is used for the acceleration and deceleration processes in the trajectory generator. The user only needs to set the three parameters of target acceleration accel, target speed speed and target stroke step to the trajectory generator.
[0178] The trajectory generator of the present invention adopts a trapezoidal curve acceleration and deceleration algorithm to design a trajectory, controls the frequency of pulse signal generation through the trajectory generator, and uses an RS-422 bus connection to send bus pulses or motion control parameters to a stepper motor driver, so that the motor can smoothly accelerate from a stationary state to a target speed, and then smoothly decelerate to a stationary state after a period of uniform motion.
[0179] In step S1, the trajectory generator adopts a trapezoidal curve acceleration and deceleration algorithm. The trapezoidal curve acceleration and deceleration algorithm uses the same acceleration in the acceleration process and the deceleration process. Step S1 specifically includes the following sub-steps S1.1-S1.3:
[0180] Sub-step S1.1: The three parameters of target acceleration accel, target speed speed and target stroke step set by the user are transmitted to the trajectory generator of the external control card or the trajectory generator inside the stepper motor driver, and the pulse increment Pulse of the kth position loop period is calculated by the trajectory generator inc (k); The trajectory generator is based on the position loop period T Pos is a fixed period, calculate each position loop period T Pos The pulse increment will be generated within a certain time. This calculation process discretizes the continuous calculation process of trapezoidal curve acceleration and deceleration into a position loop period T Pos The discrete calculation process of the iterative cycle is used to find the number of pulses generated by the trapezoidal acceleration and deceleration curve in each iterative process, which is the pulse increment of the position loop cycle.
[0181] Set the position loop period frequency f Pos Set to 2KHz, position loop cycle time T Pos Set to 500μs; set the speed loop period frequency f Spd Set to 10KHz, speed loop cycle time T Spd Set to 100μs; set the current loop cycle frequency f pwm Set to 20KHz, current loop cycle time T pwm Set to 50μs.
[0182] In step S1, the position loop control needs to receive the pulse signal and accumulate it to obtain the target position Pos of the position loop. Ref (k), at the same time, due to the characteristic of the highest starting frequency of the stepper motor, that is, the maximum pulse frequency of the normal start of the stepper motor under no-load conditions, if it is greater than this frequency, the stepper motor cannot start normally, and will cause lost steps or stalling; in addition, when the pulse frequency given to the stepper changes too quickly, the motor rotor will not be able to keep up with the changes in the electric pulse signal due to its own inertia, thereby causing the stepper motor to lose steps. Therefore, it is necessary to design a trajectory generator through an acceleration and deceleration curve to control the frequency of pulse signal generation, so that the stepper motor can smoothly accelerate from a stationary state to a target speed, and then smoothly decelerate to a stationary state after a period of uniform motion. The present invention adopts a trapezoidal acceleration and deceleration curve to design a trajectory generator. The algorithm is simple to implement, the code volume is small, and computing resources are saved. Therefore, the acceleration and deceleration algorithm does not have high performance requirements on the controller, which is convenient for reducing costs, and can meet the control requirements of smooth acceleration and deceleration, and can reduce the impact of the mechanical structure and improve the stability of motion control. The acceleration and deceleration algorithm is often used for acceleration and deceleration control of motors in the industrial field.
[0183] Among them, in sub-step S1.1, the trapezoidal curve acceleration and deceleration algorithm in the trajectory generator has five working stages, namely, idle stage, preparation stage, acceleration stage, uniform speed stage and deceleration stage. The algorithm workflow also includes the following sub-steps S1.1.1-S1.1.5:
[0184] S1.1.1: Idle stage, the three motion parameters of target acceleration accel, target speed speed and target stroke step obtained by the stepper motor driver are transmitted to the trajectory generator, and the trajectory generator enters the preparation stage from the idle stage;
[0185] S1.1.2: Preparation stage: to prepare for the algorithm work, first clear all the process variables of the algorithm to zero, and then calculate the parameters that will not participate in the algorithm iteration in the subsequent iteration cycle, so as to reduce the amount of calculation in the algorithm cycle iteration process and improve the operation efficiency. Figure 5 As shown, the preparation phase workflow includes the following sub-steps S1.1.2.1-S1.1.2.5:
[0186] S1.1.2.1: Determine whether the input target acceleration accel, target speed speed and target travel step are 0. If so, return to the idle stage and exit the trajectory generator; otherwise, clear all process variables of the algorithm;
[0187] S1.1.2.2: If the target stroke step is 1, then the output pulse increment Pulse inc(k) = 1, and return to the idle phase and exit the trajectory generator, otherwise continue to execute sub-step S1.1.2.3;
[0188] S1.1.2.3: Calculate the acceleration time accel and the uniform speed phase time uniform , the calculation expression is:
[0189] time accel =speed / accel,
[0190] time uniform =step / speed-time aceel ;
[0191] S1.1.2.4: If time uniform <0, it is judged that this trapezoidal acceleration and deceleration motion has no uniform speed stage, that is, this motion cannot reach the set target speed, and the acceleration stage time is calculated. accel and the uniform speed phase time uniform Need to recalculate, the calculation expression is:
[0192]
[0193] time uniform =0,
[0194] Otherwise, continue directly to execute sub-step S1.1.2.5;
[0195] S1.1.2.5: Calculate the intermediate variable of the pulse increment during the acceleration phase. The expression is:
[0196]
[0197] Calculate the pulse increment of each position loop cycle in the uniform speed stage. The expression is:
[0198] Pulse uniform =speed*T Pos ;
[0199] Calculate the number of iterations at the end of the acceleration phase, the expression is:
[0200] num accel_end =time accel / T Pos ;
[0201] Calculate the number of iterations at the start of the deceleration phase using the expression:
[0202] numd ecel_start =num accel_end +time uniform / T Pos ;
[0203] Calculate the number of iterations at the end of the deceleration phase, the expression is:
[0204] num decel_end =num decel_start +num accel_end ,
[0205] According to the nature of the trapezoidal acceleration / deceleration curve and the principle of using the same acceleration in the acceleration and deceleration stages, the number of iteration steps in the acceleration and deceleration stages is the same;
[0206] Calculate the number of iterations in the uniform velocity phase. The expression is:
[0207] num uniform =num decel_start -num accel_end ;
[0208] S1.1.3: Acceleration phase, the algorithm starts to iteratively calculate each position loop period T in the acceleration phase Pos The pulse increment of the acceleration phase is accumulated and counted. The pulse increment output is based on Pulse inc The integer part of (k) is used as the output. The number of pulses can only be an integer without decimals. To avoid the problem of pulse shortage or overflow caused by the existing decimals being ignored, iterate to num in the acceleration stage. accel_end When the number of steps is calculated, the number of pulses generated during the acceleration phase is Pulse accel (k) is counted and the pulse compensation coefficient Comp_k is calculated. Pulse compensation is performed in the uniform speed stage and the deceleration stage. Figure 6 As shown, the accelerated phase workflow includes the following sub-steps S1.1.3.1-S1.1.3.7:
[0209] S1.1.3.1: Initialize the number of iterations num index =0, pulse increment intermediate variable temp inc (k) = 0, pulse compensation quantity statistics Pulse comp (k) = 0, pulse increment Pulse inc (k) = 0, the pulse increment Pulse in the acceleration phase accel (k) = 0, pulse compensation number Pulse diff =0, pulse compensation coefficient comp_k = 0, intermediate variable temP of pulse compensation comp =0;
[0210] S1.1.3.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc(k), the expression is:
[0211] temp inc (k) = temp inc (k-1)+(num index +0.5)*temp accel ;
[0212] S1.1.3.3: If temp inc (k)>=1 or temp inc (k) <= -1,
[0213] Then for the intermediate variable temp inc (k) Round off to get the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0214] Pulse inc (k)=[temp inc (k)],
[0215] temp inc (k) = temp inc (k)-Pulse inc (k)
[0216] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0217] S1.1.3.4: Pulse increment during the cumulative acceleration phase accel (k), the expression is:
[0218] Pulse accel (k) = Pulse accel (k-1)+Pulse inc (k);
[0219] S1.1.3.5: If the number of iterations num index = = (num accel_end -1),
[0220] Then calculate the pulse compensation quantity Pulse diff And the pulse compensation coefficient Comp-k, the expression is:
[0221] Pulse diff =step-(2*Pulse accel (k)+num uniform *Pulse uniform ),
[0222] Comp-k=Pulse diff / (num decel_end -num accel_end );
[0223] Otherwise, continue with sub-step S1.1.3.6;
[0224] S1.1.3.6: Output the calculated pulse increment of the current iteration cycle inc (k), and the number of iteration steps num index Going one step further, the expression is: num index =num index +1.
[0225] S1.1.3.7: If the number of iterations num index <num accel_end , then in the next iteration cycle, return to sub-step S1.1.3.2 and continue execution;
[0226] Otherwise, the pulse increments the intermediate variable temp inc (k) Clear, i.e. temp inc (k)=0, the trajectory generator enters the uniform speed stage and executes S1.1.4 to perform the next iteration cycle.
[0227] S1.1.4: Uniform speed stage. According to the calculation results of the preparation stage, it is judged whether there will be a uniform speed stage in this movement. If there is a uniform speed stage, the pulse increment of each iteration cycle of the uniform speed stage is calculated, and the pulse increment is compensated according to the compensation coefficient Comp_k. If there is no uniform speed stage, it will directly jump to the deceleration stage for execution. Figure 7 As shown, the uniform speed phase workflow includes the following sub-steps S1.1.4.1-S1.1.4.5:
[0228] S1.1.4.1: If the number of iterations num index <num decel_start , then continue to execute step sub-step S1.1.4.2; otherwise, the pulse increment intermediate variable temp inc (k) Clear, i.e. temp inc (k) = 0, and jump to the deceleration phase of the trajectory generator and execute sub-step S1.1.5;
[0229] S1.1.4.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is:
[0230] temp inc (k) = temp inc (k-1)+Pulseuniform ;
[0231] S1.1.4.3: If temp inc (k)>=1 or temp inc (k)<=-1,
[0232] Then for the intermediate variable temp inc (k) Round the output pulse increment of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0233] Pulse inc (k)=[temp inc (k)],
[0234] temp inc (k) = temp inc (k)-Pulse inc (k);
[0235] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0236] S1.1.4.4: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc (k) Perform pulse compensation and count the number of compensated pulses. The expression is as follows:
[0237] temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1),
[0238] Pulse comp (k) = Pulse comp (k-1)+temp comp ,
[0239] Pulse inc (k) = Pulse inc (k)+temp comp ;
[0240] S1.1.4.5: The pulse increment Pulse calculated in this iteration cycle inc (k) Output, number of iteration steps num index Step one step further, the expression is num index =num index+1, and return to sub-step S1.1.4.1 to continue execution in the next iteration cycle;
[0241] S1.1.5: In the deceleration phase, in order to make the trajectory generator better meet the target stroke step pulse number requirements and to reduce the calculation amount and predictability of the pulse compensation in sub-step S1.1.3.6, the acceleration phase index is reversed to ensure that the number of pulses generated in the acceleration phase and the deceleration phase are consistent. Figure 8 As shown, the workflow of the deceleration phase also includes the following sub-steps S1.1.5.1-S1.1.5.5,
[0242] S1.1.5.1: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is:
[0243] temp inc (k) = temp inc (k-1)+(num accel_end -(num index -num decel_start )-0.5)*temp accel ;
[0244] S1.1.5.2: If temp inc (k)>=1 or temp inc (k)<=-1,
[0245] Then for the intermediate variable temp inc (k) Round the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as:
[0246] Pulse inc (k)=[temp inc (k)],
[0247] temp inc (k) = temp inc (k)-Pulse inc (k);
[0248] Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0;
[0249] S1.1.5.3: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc (k) Perform pulse compensation and count the number of compensated pulses. The expression is:
[0250] temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1),
[0251] Pulse comp (k) = Pulse comp (k-1)+temp comp ,
[0252] Pulse inc (k) = Pulse inc (k)+temp comp ;
[0253] S1.1.5.4: The pulse increment Pulse calculated in this iteration cycle inc (k) Output and iterate the number of steps num index Step forward, num index =num index +1;
[0254] S1.1.5.5: If the number of iterations num index <num decel_end , then in the next iteration cycle, return to step S1.1.5.1 to continue execution;
[0255] Otherwise, the iteration ends and the trajectory generator returns to the idle state, waiting for the input of subsequent control instructions.
[0256] Sub-step S1.2: The stepper motor driver receives the pulse increment Pulse inc (k), and the k-1th position loop period T Pos The total number of pulses Pulse(k-1) of the kth position loop cycle is added to obtain the total number of pulses Pulse(k) of the kth position loop cycle. The calculation expression is:
[0257] Pulse(k)=Pulse(k-1)+Pulse inc (k).
[0258] Sub-step S1.3: The total number of pulses Pulse(k) is rotated by the electronic gear inside the stepper motor driver to obtain the target position Pos of the kth position loop cycle Ref (k), the calculation expression is:
[0259]
[0260] Among them, Pos Ref(k) is the target position of the kth position loop cycle, Pulse(k) is the total number of pulses in the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom It is the denominator coefficient of the electronic gear.
[0261] Step S2: After the signal of the magnetic encoder is processed by electrical angle conversion and position feedback conversion, the feedback position Pos of the motor rotor is obtained. fb (k), set the target position Pos Ref (k) and feedback position Pos fb (k) is input into the position loop controller after subtraction, and the output is the target speed Spd Ref (k), step S2 includes the following sub-steps S2.1-S2.4,
[0262] Sub-step S2.1: Obtain the original position data of the motor rotor from the magnetic encoder, and obtain the electrical angle θ of the kth position loop period after electrical angle conversion processing. k ;
[0263] Sub-step S2.2: Electrical angle θ k After the electronic gear conversion, the position feedback Pos of the k-1th position loop cycle is obtained. fb (k-1) is added to get the position feedback Pos of the kth position loop cycle fb (k), the expression is:
[0264]
[0265] Among them, Pos fb (k) is the position feedback of the kth position loop cycle, θ k is the electrical angle of the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom is the denominator coefficient of the electronic gear;
[0266] Sub-step S2.3: Target position Pos Ref (k) and position feedback Pos fb (k) After subtraction, the position error Pos of the kth position loop cycle is obtained. Err (k), the expression is:
[0267] Pos Err (k)=Pos Ref (k)-Pos fb (k)
[0268] Among them, Pos Err (k) is the position error of the kth position loop cycle, PosRef (k) is the target position of the kth position loop cycle, Pos fb (k) is the position feedback of the kth position loop cycle;
[0269] Sub-step S2.4: Set the position error Pos Err (k) is input to the position loop controller, and the feedforward control is combined with the proportional control to output the target speed Spd of the kth speed loop cycle. Ref (k), the expression is:
[0270]
[0271] Among them, Spd Ref (k) is the target speed of the kth speed loop cycle, is the proportional coefficient of the position loop, Pos Err (k) is the position error of the kth position loop cycle, Comp Pos is the feedforward compensation coefficient of the position loop, Pos Ref (k) is the target position of the kth position loop cycle.
[0272] Step S3: Set the electrical angle θ k After speed feedback conversion processing, the speed feedback Spd is obtained fb (k), the target speed Spd Ref (k) and speed feedback Spd fb (k) is input into the speed loop controller after subtraction, and the target current of the quadrature axis is obtained as output. and the target current of the direct axis Step S3 includes the following sub-steps S3.1-S3.3,
[0273] Sub-step S3.1: The electrical angle θ obtained in step S2.1 k Data, and also as the electrical angle θ of the kth speed loop cycle k , used to obtain the speed feedback Spd of the kth speed loop cycle fb (k), the expression is:
[0274]
[0275] Among them, Spd fb (k) is the speed feedback of the kth speed loop cycle, θ k is the electrical angle of the kth speed loop cycle, Spd max is the maximum speed of the motor, Enc max The maximum range of the magnetic encoder sampling;
[0276] Sub-step S3.2: The target speed Spd obtained in step S2.4 isRef (k) and speed feedback value Spd fb (k) is subtracted to obtain the speed error Spd of the kth speed loop cycle Err (k), the expression is:
[0277] Sd Err (k) = Spd Ref (k)-Spd fb (k)
[0278] Among them, Spd Err (k) is the speed error of the kth speed loop cycle, Spd Ref (k) is the target speed of the kth speed loop cycle, Spd fb (k) is the speed feedback of the kth speed loop cycle;
[0279] Sub-step S3.3: Set the speed error Spd Err (k) is input to the speed loop controller, and after the feedforward control and proportional integral control are combined, the target current of the quadrature axis is output. The expression is:
[0280]
[0281] in, is the target current of the quadrature axis, is the proportional coefficient of the speed loop controller, is the integral coefficient of the speed loop controller, Spd Err (k) is the speed error of the kth speed loop cycle, Comp Spd is the feedforward compensation coefficient of the speed loop, Spd Ref (k) is the target speed of the kth speed loop cycle.
[0282] Step S4: Figure 1 As shown, the currents of the α and β axes are obtained by sampling and filtering the A and B phase currents of the two-phase hybrid stepping motor, and the quadrature axis current I is obtained by performing Park transformation on the obtained α and β axis currents. q and the direct axis current I d , the quadrature axis target current With the quadrature axis current I q Differential, direct axis target current With direct axis current I d The difference is then input into the current loop controller to obtain the quadrature axis output voltage U acting on the quadrature axis. α And the direct axis output voltage U acting on the direct axis d , step S4 includes the following sub-steps S4.1-S4.4,
[0283] Sub-step S4.1: The A and B phase currents are obtained by sampling the phase current sampling circuit. Since the A and B phase coils of the two-phase hybrid stepper motor are perpendicular to each other and independent of each other, there is no need to go through the Clark transformation in the vector control method. The A and B phase currents are directly used as the α and β axis currents I α with I β .
[0284] Sub-step S4.2: The electrical angle θ obtained in step S2.1 k Data can also be used as the electrical angle θ of the kth current loop cycle k , combined with the α and β axis currents I α with I β After Park transformation, the quadrature axis current I is obtained. q , direct axis current I d , the expression is as follows:
[0285] I q =I β *cos(θ k )-I α *sin(θ k )
[0286] I d =I α *cos(θ k )+I β *sin(θ k )
[0287] Sub-step S4.3: The target current of the quadrature axis obtained by step S3.3 and direct axis target current Respectively with the quadrature axis current I q and the direct axis current I d , and the quadrature-axis current error is obtained and direct axis current error The expression is,
[0288]
[0289] in, As the target current of the direct axis, its essence is to achieve static decoupling of the quadrature axis and the direct axis current. d = 0, the magnetic flux is completely provided by the permanent magnet, which can make the motor have no direct-axis armature reaction, that is, the motor has no torque on the direct axis, and all the torque of the motor is provided by the quadrature-axis current I q To generate and control, improving the utilization rate of current.
[0290] Sub-step S4.4: Input the current error of the quadrature axis and the direct axis into the current loop controller, i.e. the proportional integral controller, and output the quadrature axis output voltage U q With direct axis output voltage U d , the expression is as follows:
[0291]
[0292] Among them, U q Quadrature axis output voltage, is the quadrature-axis current loop proportionality coefficient, is the integral coefficient of the quadrature-axis current loop, is the quadrature-axis current error of the kth current loop cycle.
[0293] Among them, U d The direct axis output voltage and is the proportional coefficient of the direct axis current loop, is the integral coefficient of the direct axis current loop, is the direct-axis current error of the kth current loop cycle.
[0294] Step S5: Output voltage U of the quadrature axis q With direct axis output voltage U d Perform the inverse Park transform to obtain the voltage vector component U that needs to be output to the α-axis in the current loop cycle. α And the voltage vector component U output to the β axis β , the expression is,
[0295] U α =U d *cos(θ k )-U q *sin(θ k ),
[0296] U β =U d *sin(θ k )+U q *cos(θ k ),
[0297] After completing the voltage vector component U α with U β After calculation, the voltage vector component U α with U β Limiting is performed to prevent the synthesized desired voltage vector U Ref The bus voltage U DC , to avoid motor loss of control due to over-modulation, and to constrain the spatial voltage vector amplitude of the current loop output, U α with U βThe following constraints must be met, and the expression is:
[0298]
[0299] When the constraints are exceeded, a new voltage vector needs to be given, and the expression is:
[0300]
[0301] in, and A new voltage vector is given under the constraints.
[0302] Step S6: Obtain the voltage vector component U to be output to the α and β axes through step S5 α with U β , respectively for U α with U β The positive and negative directions of the vector direction are judged, and the expected voltage vector U is obtained. Ref In the sector where it is located, a two-phase SVPWM drive signal is generated and the corresponding four-way PWM drive signal is output to the dual H-bridge inverter drive circuit, so that the motor stator of the two-phase hybrid stepper motor generates a magnetic field consistent with the direction of the voltage synthesis vector and controls the rotor to rotate in the vector direction, so as to realize vector control of the two-phase hybrid stepper motor.
[0303] Since the present invention is based on the design of a two-phase hybrid stepper motor, the SVPWM control scheme used to control the traditional three-phase inverter is no longer applicable. Figure 2As shown, the upper half bridge of the double H-bridge inverter drive circuit is controlled by PWMA_HS, PWMB_HS, PWMC_HS and PWMD_HS, and the lower half bridge of the double H-bridge inverter drive circuit is controlled by PWMA_LS, PWMB_LS, PWMC_LS and PWMD_LS. The PWMA_HS, PWMB_HS, PWMC_HS, PWMD_HS and PWMA_LS, PWMB_LS, PWMC_LS, PWMD_LS are control signals obtained by converting the input PWMA, PWMB, PWMC, PWMD signals inside the motor drive chip, and are used to control the conduction and closure of the upper and lower half bridges. Dead time is added in the switching process of the upper and lower half bridges of the double H-bridge inverter drive circuit to avoid short circuit caused by the simultaneous conduction of the upper and lower half bridges. The dual H-bridge inverter drive circuit has four PWM signals at the input, but since only two phases of the two-phase hybrid stepper motor need to be controlled, only one of the PWMA and PWMB of phase A and one of the PWMC and PWMD of phase B need to be controlled in one current loop cycle. This signal is responsible for controlling the conduction and closing time of the upper and lower half bridges on one side of the H-bridge, and the other PWM signal maintains a low-level output to maintain the conduction of the lower half bridge on the other side of the H-bridge to ensure that current flows through the motor coil.
[0304] In step S6, the two-phase SVPWM drive signal is generated to realize vector control of the two-phase hybrid stepping motor. Step S6 includes the following sub-steps S6.1-S6.4:
[0305] Sub-step S6.1: Obtain the voltage vector component U to be output to the α and β axes through step S5 α with U β , respectively for U α with U β The positive and negative directions of the vector direction are judged to obtain the expected voltage vector U Ref The sector is determined according to the following principles:
[0306] When U α >0,U β >0, the expected voltage vector U Ref In sector I.
[0307] When U α <=0,U β >0, the expected voltage vector U Ref In sector II,
[0308] When U α <=0,U β <=0, the expected voltage vector U Ref Located in sector III,
[0309] When U α >0,U β <=0, the expected voltage vector U Ref Located in sector IV.
[0310] Sub-step S6.2: The bus voltage U can be obtained through the bus voltage sampling circuit DC The current loop cycle frequency is 20KHz, the carrier frequency is relatively high, and the voltage vector component U is obtained by using the volt-second balance principle. α with U β In a current loop period T pwm The time T that acts on the α axis and the β axis respectively α With T β , the expression is,
[0311]
[0312] Among them, T α With T β is the voltage vector U α with U β The time taken by the current acting on the α-axis and the β-axis in one current loop cycle, |U α |with|U β | is the voltage vector U on the α and β axes α with U β Take the absolute value, U DC is the bus voltage, T pwm is a current loop cycle time;
[0313] Due to the need for phase current sampling time, it is necessary to retain the necessary zero vector time T0 required for phase current sampling in one current loop cycle, so it is necessary to set T α With T β Constrain and set the voltage vector component U α with U β The maximum time T acting in one current loop cycle max If T α or T β Exceeding the maximum time T max Constraints, then we need to re-given U α or U β Action time:
[0314]
[0315] in, and After exceeding the constraint, the new U α with U β The acting time in one current loop cycle.
[0316] Sub-step S6.3: According to the expected voltage vector U Ref The sector and the calculated T α With T β , distribute and adjust the positive duty cycle time of the four-way PWM drive signal output to the dual H-bridge inverter drive circuit in one current loop cycle, as shown in Table 2,
[0317] Sector I II III IV PWMA Tα 0 0 Tα PWMB 0 Tα Tα 0 PWMC Tβ Tβ 0 0 PWMD 0 0 Tβ Tβ
[0318] Table 2- Output duty cycle time of four-way PWM drive signal
[0319] The four PWM drive signals are PWMA, PWMB, PWMC and PWMD. The PWM drive signal adjusts the duty cycle of each cycle in a center-aligned manner. The two-phase four-wire drive signal acts on the two-phase hybrid stepper motor, so that the motor stator generates a magnetic field consistent with the direction of the voltage vector synthesis to control the rotor to rotate to the desired voltage vector U Ref In the vector direction, to achieve vector control of the two-phase hybrid stepper motor,
[0320] When U Ref When in sector I, the positive duty cycle time of the PWMA signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMB signal and the PWMD signal outputs maintain a low level output in the current current loop cycle;
[0321] When U Ref When in sector II, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMA signal and the PWMD signal outputs maintain a low level output in the current current loop cycle;
[0322] When U Ref When in sector III, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMD signal is T β , the PWMA signal and the PWMC signal outputs maintain a low level output in the current current loop cycle;
[0323] When U Ref When in sector IV, the positive duty cycle time of the PWMA signal is T α , the positive duty cycle time of the PWMD signal is T β , the PWMB signal and the PWMC signal outputs maintain a low level output in the current current loop cycle.
[0324] Sub-step S6.4: According to the allocated four-way PWM positive duty cycle time, combined with the dead time and the necessary zero vector time T0, the motor driver outputs the corresponding four-way PWM drive signal to the dual H-bridge inverter drive circuit, and the desired voltage vector U is obtained. Ref , the expected voltage vector U Ref The vector synthesis direction and PWM waveform output in four sectors are as follows Figure 9-12 As shown, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop period T pwm The time taken up in .
[0325] The input of the dual H-bridge inverter drive circuit has four PWM signals. Figure 2 As shown, the conduction and closing of the upper and lower half bridges at both ends of the H bridge of the A phase and the B phase of the motor are controlled respectively to control the voltage output of the A phase and the B phase. As shown in the sub-step S6.3, in one current loop cycle, two PWM signals are output to both ends of the H bridge, one of which controls the conduction and closing time of the upper and lower half bridges on one side of the H bridge, and the other maintains a low level output to maintain the conduction of the lower half bridge on the other side of the H bridge;
[0326] For a two-phase hybrid stepper motor, the vector control refers to using the space voltage vectors on the α-axis and the β-axis as base vectors to synthesize vectors of any angle. In each sector, two adjacent voltage vectors and the zero vector U0 are selected, and any voltage vector in each sector is synthesized according to the volt-second balance principle. The expression is:
[0327]
[0328] The above expression is discretized to be equivalent to:
[0329] U Ref *T pwm =U α *T α +U β *T β +U0*T0,
[0330] Among them, the vector voltage U α With vector voltage U β Independent of each other, vector voltage U α With vector voltage U β Acting on two-phase coils at the same time, U Ref is the voltage vector we expect, T pwm is a current loop cycle time, T α With T β is the vector voltage U α with U β In a current loop period T pwmThe time occupied by the zero vector U0 acting on the α axis and the β axis respectively, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop cycle T pwm The time taken up in .
[0331] It can be seen from the discretized equivalent formula that the duty ratios of the α-axis and the β-axis in one current loop cycle are configured to synthesize an equivalent space voltage vector of any angle and realize vector control. And because the two-phase coils of the motor are different from the traditional three-phase coils that are connected in pairs, the two-phase coils are independent and perpendicular to each other, so it is not necessary to use a five-segment or seven-segment SVPWM to realize the vector voltage U in a single current loop cycle. α with U β The transition switching between the vector voltage U α with U β They are independent of each other and do not interfere with each other, and can act on two-phase coils at the same time. Compared with five-segment or seven-segment SVPWM, two-phase SVPWM reduces the cycle time occupied by the zero vector, retains only the necessary zero vector time required for phase current sampling, and increases the action time of the base axis voltage vector, thereby increasing the expected voltage vector U Ref The vector size of the bus voltage is increased, which improves the utilization rate of the bus voltage and increases the rotational torque of the motor to a certain extent.
[0332] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
Claims
1. A dual closed-loop vector control method for a two-phase hybrid stepping motor, characterized in that: The two-phase hybrid stepper motor is composed of a stator with multiple tooth slots arranged according to a set rule and a rotor with axially magnetized embedded permanent magnets. Through the detection of current and rotor position and negative feedback control, the two-phase hybrid stepper motor realizes position and current double closed-loop control from a structural perspective, including the following steps: Step S1: Obtain pulse increments through a trajectory generator set in an external control card or a trajectory generator set inside a stepper motor driver, and convert the pulse increments into target positions to obtain the target position Pos of the position loop. Ref (k); Step S2: After the signal of the magnetic encoder is processed by electrical angle conversion and position feedback conversion, the feedback position Pos of the motor rotor is obtained. fb (k), set the target position Pos Ref (k) and feedback position Pos fb (k) is input into the position loop controller after subtraction, and the output is the target speed Spd Ref (k); Step S3: Set the electrical angle θ k After speed feedback conversion processing, the speed feedback Spd is obtained fb (k), the target speed Spd Ref (k) and speed feedback Spd fb (k) is input into the speed loop controller after subtraction, and the target current of the quadrature axis is obtained as output. and the target current of the direct axis Step S4: The currents of the α and β axes are obtained by sampling and filtering the A and B phase currents of the two-phase hybrid stepping motor, and the quadrature axis current I is obtained by performing Park transformation on the obtained α and β axis currents. q and the direct axis current I d , the quadrature axis target current With the quadrature axis current I q Differential, direct axis target current With direct axis current I d The difference is then input into the current loop controller to obtain the quadrature axis output voltage U acting on the quadrature axis. q And the direct axis output voltage U acting on the direct axis d ; The expression of Parker transformation is, I q =I β *cos(θ k )-I α *sin(θ k ) I d =I α *cos(θ k )+I β *sin(θ k ) Step S5: Output voltage U of the quadrature axis q With direct axis output voltage U d Perform the inverse Park transform to obtain the voltage vector component U that needs to be output to the α-axis in the current loop cycle. a And the voltage vector component U output to the β axis β ; Quadrature axis output voltage U q With direct axis output voltage U d After the inverse Park transformation, the voltage vector component U that needs to be output to the α and β axes in the current loop cycle is obtained. α with U β , the expression of Parker's inverse transform is, U α =U d *cos(θ k )-U q *sin(θ k ) IN β =U d *sin(θ k )+U q *cos(θ k ) Step S6: Obtain the voltage vector component U to be output to the α and β axes through step S5 α with U β , respectively for U α with U β The positive and negative directions of the vector direction are judged, and the expected voltage vector U is obtained. Ref In the sector where it is located, a two-phase SVPWM drive signal is generated and the corresponding four-way PWM drive signal is output to the dual H-bridge inverter drive circuit, so that the motor stator of the two-phase hybrid stepper motor generates a magnetic field consistent with the direction of the voltage synthesis vector and controls the rotor to rotate in the vector direction, so as to realize vector control of the two-phase hybrid stepper motor.
2. The dual closed-loop vector control method for a two-phase hybrid stepping motor according to claim 1, characterized in that: The step S6: generating the two-phase SVPWM drive signal to realize vector control of the two-phase hybrid stepping motor, the step S6 includes the following sub-steps: S6.1: Obtain the voltage vector component U to be output to the α and β axes through step S5 a with U β , respectively for the voltage vector component U α with U β The positive and negative directions of the vector direction are judged to obtain the expected voltage vector U Ref The sector where the judgment is made is as follows: When U α >0,U β >0, the expected voltage vector U Ref In sector I, When U α <=0, U β >0, the expected voltage vector U Ref In sector II, When U α <=0,U β <=0, the expected voltage vector U Ref Located in sector III, When U α >0,U β <=0, the expected voltage vector U Ref Located in sector IV; S6.2: The bus voltage U can be obtained through the bus voltage sampling circuit DC The current loop cycle frequency is 20KHz, and the voltage vector component U is obtained by using the volt-second balance principle. α with U β In a current loop period T pwm The time T that acts on the α axis and the β axis respectively α With T β , the expression is, Among them, T α With T β is the voltage vector U α with U β The time taken by the current acting on the α-axis and the β-axis in one current loop cycle, |U α |with|U β | is the voltage vector U on the α and β axes α with U β Take the absolute value, U DC is the bus voltage, T pwm is a current loop cycle time; S6.3: According to the expected voltage vector U Ref The sector and the calculated T α With T β , distribute and adjust the positive duty cycle time of the four-way PWM drive signal output to the dual H-bridge inverter drive circuit in one current loop cycle, the PWM drive signal adjusts the duty cycle time of each cycle in a center-aligned manner, and applies the two-phase four-wire drive signal to the two-phase hybrid stepper motor, so that the motor stator generates a magnetic field consistent with the voltage vector synthesis direction to control the rotor to rotate to the desired voltage vector U Ref In the vector direction, to achieve vector control of the two-phase hybrid stepper motor, The four PWM drive signals are PWMA signal, PWMB signal, PWMC signal and PWMD signal. When the expected voltage vector U Ref When in sector I, the positive duty cycle time of the PWMA signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMB signal and the PWMD signal outputs maintain a low level output in the current current loop cycle; When the expected voltage vector U Ref When in sector II, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMC signal is T β , the PWMA signal and the PWMD signal outputs maintain a low level output in the current current loop cycle; When the expected voltage vector U Ref When in sector III, the positive duty cycle time of the PWMB signal is T α , the positive duty cycle time of the PWMD signal is T β , the PWMA signal and the PWMC signal outputs maintain a low level output in the current current loop cycle; When the expected voltage vector U Ref When in sector IV, the positive duty cycle time of the PWMA signal is T α , the positive duty cycle time of the PWMD signal is T β , the PWMB signal and the PWMC signal outputs maintain a low level output in the current current loop cycle; S6.4: According to the allocated four-way PWM positive duty cycle time and dead time, and combined with the necessary zero vector time T0, the motor driver outputs the corresponding four-way PWM drive signal to the dual H-bridge inverter drive circuit, and the desired voltage vector U is obtained. Ref , Among them, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop period T pwm The time taken up in .
3. The double closed-loop vector control method of a two-phase hybrid stepping motor according to claim 2, characterized in that: Step S5: After completing the voltage vector component U α with U β After calculation, the voltage vector component U α with U β Limiting is performed to prevent the desired voltage vector U from being synthesized. Ref appears greater than the bus voltage U DC , to avoid motor loss of control due to over-modulation, and to constrain the spatial voltage vector amplitude of the current loop output. The voltage vector component U α with U β The following constraints must be met, and the expression is: When the constraints are exceeded, a new voltage vector needs to be given, and the expression is: in, and A new voltage vector is given under the constraints; When a new voltage vector is given in step S5, in the sub-step S6.2, due to the need for phase current sampling time, it is necessary to retain the necessary zero vector time T0 required for phase current sampling in one current loop cycle, so it is necessary to adjust T α With T β Constrain and set the voltage vector component U α with U β The maximum time T acting in one current loop cycle max , if T α or T β Exceeding the maximum time T max Constraints, then we need to re-given U α or U β The action time is expressed as, in, and After exceeding the constraint, the voltage vector component U is re-given α with U β The acting time in one current loop cycle.
4. The dual closed-loop vector control method for a two-phase hybrid stepping motor according to claim 1, characterized in that: In step S1, the pulse signal is received by the position loop control and accumulated to obtain the target position Pos of the position loop. Ref (k), the trajectory generator is provided inside the external control card and the stepper motor driver, the trajectory generator uses a trapezoidal curve acceleration and deceleration algorithm to design the trajectory, the frequency of pulse signal generation is controlled by the trajectory generator, and the bus pulse or motion control parameter is sent to the stepper motor driver by RS-422 bus connection; In step S6, the dual H-bridge inverter drive circuit is input with four PWM signals, which respectively control the conduction and closing of the upper and lower half bridges at both ends of the H-bridge of the A phase and the B phase of the motor to control the voltage output of the A phase and the B phase; In the sub-step S6.3, in one current loop cycle, two PWM signals are output to both ends of the H bridge, one PWM signal controls the on and off time of the upper and lower half bridges on one side of the H bridge, and the other PWM signal maintains a low level output to maintain the on of the lower half bridge on the other side of the H bridge. Dead time is added during the on and off switching of the upper and lower half bridges to avoid short circuit caused by the upper and lower half bridges being on at the same time; The vector control of the two-phase hybrid stepper motor refers to using the space voltage vectors on the α-axis and the β-axis as the basis vector to synthesize a vector of any angle. In each sector, two adjacent voltage vectors and the zero vector U0 are selected to synthesize any voltage vector in each sector according to the volt-second balance principle. The expression is: The above expression is discretized to be equivalent to: U Ref *T pwm =U α *T α +U β *T β +U0*T0 Among them, the vector voltage U α With vector voltage U β Independent of each other, vector voltage U α With vector voltage U β Acting on two-phase coils at the same time, U Ref is the voltage vector we expect, T pwm is a current loop cycle time, T α With T β is the vector voltage U α with U β In a current loop period T pwm The time occupied by the zero vector U0 acting on the α axis and the β axis respectively, U0 is the zero vector, and the zero vector time T0 is the zero vector U0 in a current loop cycle T pwm The time taken up in The duty ratios of the α-axis and the β-axis in one current loop cycle are configured to synthesize an equivalent space voltage vector of any angle and realize vector control.
5. A dual closed-loop vector control method for a two-phase hybrid stepping motor according to any one of claims 1 to 4, characterized in that: In step S1, the trajectory generator adopts a trapezoidal curve acceleration and deceleration algorithm, and the trapezoidal curve acceleration and deceleration algorithm uses the same acceleration in the acceleration process and the deceleration process. Step S1 includes the following sub-steps: S1.1: The three parameters of target acceleration accel, target speed speed and target stroke step set by the user are transmitted to the trajectory generator of the external control card or the trajectory generator inside the stepper motor driver, and the pulse increment Pulse of the kth position loop period is calculated by the trajectory generator inc (k); S1.2: The stepper motor driver receives the pulse increment Pulse inc (k), and the k-1th position loop period T Pos The total number of pulses Pulse(k-1) of the kth position loop cycle is added to obtain the total number of pulses Pulse(k) of the kth position loop cycle. The calculation expression is: Pulse(k)=Pulse(k-1)+Pulse inc (k); S1.3: The total number of pulses Pulse (k) is rotated by the electronic gear inside the stepper motor driver to obtain the target position Pos of the kth position loop cycle Ref (k), the calculation expression is: Among them, Pos Ref (k) is the target position of the kth position loop cycle, Pulse(k) is the total number of pulses in the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom It is the denominator coefficient of the electronic gear.
6. The double closed-loop vector control method of a two-phase hybrid stepping motor according to claim 5, characterized in that: In step S1.1, the stepper motor driver uses RS-422 bus to receive the pulse increment in combination with the internal trajectory generator, and combines the position loop with the position loop period T Pos Generate the pulse increment of the current cycle of the trapezoidal acceleration and deceleration curve; The trajectory generator is based on the position loop period T Pos is a fixed period, calculate each position loop period T Pos The pulse increment will be generated within a certain time. This calculation process discretizes the continuous calculation process of trapezoidal curve acceleration and deceleration into a position loop period T Pos The discrete calculation process of the iterative cycle is used to find the number of pulses generated by the trapezoidal acceleration and deceleration curve in each iterative process, which is the pulse increment of the position loop cycle. Set the position loop period frequency f Pos Set to 2KHz, position loop cycle time T Pos Set to 500μs; set the speed loop period frequency f Spd Set to 10KHz, speed loop cycle time T Spd Set to 100μs; set the current loop cycle frequency f pwm Set to 20KHz, current loop cycle time T pwm Set to 50μs.
7. The double closed-loop vector control method of a two-phase hybrid stepping motor according to claim 5, characterized in that: The sub-step S1.1, the trajectory generator includes five working stages in the trapezoidal curve acceleration and deceleration algorithm, namely, an idle stage, a preparation stage, an acceleration stage, a uniform speed stage and a deceleration stage. The sub-step S1.1 includes the following sub-steps: S1.1.1: Idle stage, the three motion parameters of the target acceleration accel, the target speed speed and the target stroke step acquired by the stepper motor driver are transmitted to the trajectory generator, and the trajectory generator enters the preparation stage from the idle stage; S1.1.2: Preparation stage, to prepare for the algorithm work, first clear all the algorithm process variables, and then calculate the parameters that will not participate in the algorithm iteration in the subsequent iteration cycle, so as to reduce the amount of calculation in the algorithm cycle iteration process and improve the operation efficiency; S1.1.3: Acceleration phase, the algorithm starts to iteratively calculate each position loop period T in the acceleration phase Pos The pulse increment of the acceleration phase is accumulated and counted. The pulse increment output is based on Pulse inc The integer part of (k) is used as the output. The number of pulses can only be an integer without decimals. To avoid the problem of pulse shortage or overflow caused by the existing decimals being ignored, iterate to num in the acceleration stage. accel_end When the number of steps is calculated, the number of pulses generated during the acceleration phase is Pulse accel (k) Perform statistics and calculate the pulse compensation coefficient Comp_k to perform pulse compensation in the uniform speed stage and the deceleration stage; S1.1.4: Uniform speed stage: judge whether there will be a uniform speed stage in this movement according to the calculation results of the preparation stage. If there is a uniform speed stage, calculate the pulse increment of each iteration cycle of the uniform speed stage, and compensate the pulse increment according to the compensation coefficient Comp_k. If there is no uniform speed stage, jump directly to the deceleration stage for execution; S1.1.5: In the deceleration phase, in order to make the trajectory generator better meet the target stroke step pulse number requirements and to reduce the amount of pulse compensation calculation and predictability, the acceleration phase index is reversed to ensure that the number of pulses generated in the acceleration phase is consistent with that in the deceleration phase.
8. The dual closed-loop vector control method for a two-phase hybrid stepping motor according to claim 7, characterized in that: The sub-step S1.1.2, the preparation phase workflow includes the following sub-steps: S1.1.2.1: Determine whether the input target acceleration accel, target speed speed and target travel step are 0. If so, return to the idle stage and exit the trajectory generator; Otherwise, all algorithm process variables are reset to zero; S1.1.2.2: If the target stroke step is 1, then the output pulse increment Pulse inc (k) = 1, and return to the idle phase and exit the trajectory generator, otherwise continue to execute sub-step S1.1.2.3; S1.1.2.3: Calculate the acceleration time accel and the uniform speed phase time uniform , the calculation expression is: time accel =speed / accel time uniform =step / speed-time accel ; S1.1.2.4: If time uniform <0, it is judged that this trapezoidal acceleration and deceleration motion has no uniform speed stage, that is, this motion cannot reach the set target speed, and the acceleration stage time is calculated. accel and the uniform speed phase time uniform Need to recalculate, the calculation expression is: time uniform =0 Otherwise, continue directly to execute sub-step S1.1.2.5; S1.1.2.5: Calculate the intermediate variable of the pulse increment during the acceleration phase. The expression is: Calculate the pulse increment of each position loop cycle in the uniform speed stage. The expression is: Pulse uniform =speed*T Pos ; Calculate the number of iterations at the end of the acceleration phase, the expression is: num accel_end =time accel / T Pos ; Calculate the number of iterations at the start of the deceleration phase using the expression: whether decel_start =number accel_end +time uniform / T Pos ; Calculate the number of iterations at the end of the deceleration phase, the expression is: whether decel_end =number decel_start +num accel_end , According to the nature of the trapezoidal acceleration / deceleration curve and the principle of using the same acceleration in the acceleration and deceleration stages, the number of iteration steps in the acceleration and deceleration stages is the same; Calculate the number of iterations in the uniform velocity phase. The expression is: whether uniform =number decel_start -num accel_end ; The sub-step S1.1.3, the acceleration phase workflow includes the following sub-steps, S1.1.3.1: Initialize the number of iterations num index =0, pulse increment intermediate variable temp inc (k) = 0, pulse compensation quantity statistics Pulse comp (k) = 0, pulse increment Pulse inc (k) = 0, the pulse increment Pulse in the acceleration phase accel (k) = 0, pulse compensation number Pulse diff =0, pulse compensation coefficient Comp_k = 0, the intermediate variable temp of pulse compensation comp =0; S1.1.3.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is: temp inc (k)=temp inc (k-1)+(nun index +0.5)*temp accel ; S1.1.3.3: If temp inc (k)>=1 or temp inc (k)<=-1, Then for the intermediate variable temp inc (k) Round off to get the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as: Pulse inc (k)=[temp inc (k)] temp inc (k)=temp inc (k)-PulSe inc (k) Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0; S1.1.3.4: Pulse increment Pulseac during the cumulative acceleration phase cel (k), the expression is: Pulse accel (k)=Pulse accel (k-1)+Pulse inc (k); S1.1.3.5: If the number of iterations num index = = (num accel_end -1), Then calculate the pulse compensation quantity Pulse diff And the pulse compensation coefficient Comp_k, the expression is: Pulse diff =step-(2*Pulse accel (k)+num uniform *Pulse uniform ) Comp_k=Pulse diff / (num decel_end -num accel_end ); Otherwise, continue with sub-step S1.1.3.6; S1.1.3.6: Output the calculated pulse increment of the current iteration cycle inc (k), and the number of iteration steps num index Going one step further, the expression is: num index =num index +1; S1.1.3.7: If the number of iterations num index <num accel_end , then in the next iteration cycle, return to sub-step S1.1.3.2 and continue execution; Otherwise, the pulse increments the intermediate variable tempin c (k) Clear, i.e., temmpin c (k) = 0, the trajectory generator enters the uniform speed stage and executes S1.1.4 to perform the next iteration cycle; The sub-step S1.1.4, the uniform speed phase workflow includes the following sub-steps: S1.1.4.1: If the number of iterations num index <num decel_start , then continue to execute step sub-step S1.1.4.2; otherwise, the pulse increment intermediate variable temp inc (k) Clear, i.e. temp inc (k) = 0, and jump to the deceleration phase of the trajectory generator and execute sub-step S1.1.5; S1.1.4.2: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is: temp inc (k)=temp inc (k-1)+Pulse uniform S1.1.4.3: If temp inc (k)>=1 or temp inc (k)<=-1, Then for the intermediate variable temp inc (k) Round the output pulse increment of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as: Pulse inc (k)=[temp inc (k)] temp inc (k)=temp inc (k)-Pulse inc (k); Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0; S1.1.4.4: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc (k) Perform pulse compensation and count the number of compensated pulses. The expression is as follows: temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1) Pulse comp (k)=Pulse comp (k-1)+temp comp , Pulse inc (k)=Pulse inc (k)+temp comp ; S1.1.4.5: The pulse increment Pulse calculated in this iteration cycle inc (k) Output, number of iteration steps num index Step one step further, the expression is num index =num index +1, and return to sub-step S1.1.4.1 to continue execution in the next iteration cycle; The sub-step S1.1.5, the workflow of the deceleration stage further includes the following sub-steps, S1.1.5.1: Calculate the intermediate variable temp of the pulse increment of the current cycle inc (k), the expression is: temp inc (k)=temp inc (k-1)+(num accel_end -(num index -num decel_start ) -0.5)*temp accel ; S1.1.5.2: If temp inc (k)>=1 or temp inc (k) <= -1, Then for the intermediate variable temp inc (k) Round the pulse increment Pulse of the current iteration cycle inc (k) and retain the intermediate variable temp inc The decimal part of (k) is expressed as: Pulse inc (k)=[temp inc (k)], temp inc (k)=temp inc (k)-Pulse inc (k); Otherwise, the pulse increment of the current iteration cycle is Pulse inc (k) = 0; S1.1.5.3: Pulse increment of the current iteration cycle according to the compensation coefficient Comp_k inc (k) Perform pulse compensation and count the number of compensated pulses. The expression is: temp comp =Comp_k*(num index -num accel_end +1)-Pulse comp (k-1) Pulse comp (k)=Pulse comp (k-1)+temp comp Pulse inc (k)=Pulse inc (k)+temp comp ; S1.1.5.4: The pulse increment Pulse calculated in this iteration cycle inc (k) Output and iterate the number of steps num index Step forward, num index =num index +1; S1.1.5.5: If the number of iterations num index <num decel_end , then in the next iteration cycle, return to step S1.1.5.1 to continue execution; Otherwise, the iteration ends and the trajectory generator returns to the idle state, waiting for the input of subsequent control instructions.
9. The double closed-loop vector control method of a two-phase hybrid stepping motor according to claim 5, characterized in that: In step S2, the magnetic encoder obtains the feedback position Pos of the motor rotor after the electrical angle conversion and position feedback conversion processing. fb (k), set the target position Pos Ref (k) and feedback position Pos fb (k) After the difference is made, it is input into the position loop controller and output to obtain the target speed Spd Ref (k), step S2 includes the following sub-steps: S2.1: Get the original position data of the motor rotor from the magnetic encoder, and convert it into an electrical angle to get the electrical angle θ of the kth position loop period. k ; S2.2: Electrical angle θ k After the electronic gear conversion, the position feedback Pos of the k-1th position loop cycle is obtained. fb (k-1) is added to get the position feedback Pos of the kth position loop cycle fb (k), the expression is: Among them, Pos fb (k) is the position feedback of the kth position loop cycle, θ k is the electrical angle of the kth position loop cycle, Gear mole is the numerator coefficient of the electronic gear, Gear denom is the denominator coefficient of the electronic gear; S2.3: Target position Pos Ref (k) and position feedback Pos fb (k) After subtraction, the position error Pos of the kth position loop cycle is obtained. Err (k), the expression is: Pos Err (k)=Pos Ref (k)-Pos fb (k) Among them, Pos Err (k) is the position error of the kth position loop cycle, Pos Ref (k) is the target position of the kth position loop cycle, Pos fb (k) is the position feedback of the kth position loop cycle; S2.4: Set the position error Pos Err (k) is input to the position loop controller, and the feedforward control is combined with the proportional control to output the target speed Spd of the kth speed loop cycle. Ref (k), the expression is: Among them, Spd Ref (k) is the target speed of the kth speed loop cycle, is the proportional coefficient of the position loop, Pos Err (k) is the position error of the kth position loop cycle, Comp Pos is the feedforward compensation coefficient of the position loop, Pos Ref (k) is the target position of the kth position loop cycle.
10. The double closed-loop vector control method of a two-phase hybrid stepping motor according to claim 5, characterized in that: In step S3, the electrical angle θ k After speed feedback conversion processing, the speed feedback Spd is obtained fb (k), the target speed Spd Ref (k) and speed feedback Spd fb (k) is input into the speed loop controller after subtraction, and the target current of the quadrature axis is obtained as output. Step S3 includes the following sub-steps, S3.1: The electrical angle θ obtained in step S2.1 k Data, and also as the electrical angle θ of the kth speed loop cycle k , used to obtain the speed feedback Spd of the kth speed loop cycle fb (k), the expression is: Among them, Spd fb (k) is the speed feedback of the kth speed loop cycle, θ k is the electrical angle of the kth speed loop cycle, Spd max is the maximum speed of the motor, Enc max The maximum range of the magnetic encoder sampling; S3.2: The target speed Spd obtained in step S2.4 is Ref (k) and speed feedback value Spd fb (k) is subtracted to obtain the speed error Spd of the kth speed loop cycle Err (k), the expression is: Spd Err (k)=Spd Ref (k)-Spd fb (k) Among them, Spd Err (k) is the speed error of the kth speed loop cycle, Spd Ref (k) is the target speed of the kth speed loop cycle, Spd fb (k) is the speed feedback of the kth speed loop cycle; S3.3: Set the speed error Spd Err (k) is input to the speed loop controller, and after the feedforward control and proportional integral control are combined, the target current of the quadrature axis is output. The expression is: in, is the target current of the quadrature axis, is the proportional coefficient of the speed loop controller, is the integral coefficient of the speed loop controller, Spd Err (k) is the speed error of the kth speed loop cycle, Comp Spd is the feedforward compensation coefficient of the speed loop, Spd Ref (k) is the target speed of the kth speed loop cycle.
Citation Information
Patent Citations
Two-phase hybrid stepping-motor closed loop control method
CN106961233A
Two-phase hybrid stepping motor position closed-loop vector control method and system
CN113067509A
Synchronization error compensation method for motion controlling of two-axis linked mechanical arm
CN106227154A
Closed-loop control device and method for two-phase hybrid stepping motor
CN107040178A
Servo motor positioning method and servo positioning device
CN114257153A