ADRC-based brushless direct current motor servo system software design method

文档序号:1299809 发布日期:2020-08-07 浏览:30次 中文

阅读说明:本技术 基于adrc的无刷直流电机伺服系统软件设计方法 (ADRC-based brushless direct current motor servo system software design method ) 是由 熊威 于 2020-04-24 设计创作,主要内容包括:本发明公开了基于ADRC的无刷直流电机伺服系统软件设计方法,属于无刷直流电机技术领域,通过对主程序的设计、中断程序的设计、换相程序以及转速计算程序的设计,软件将电动机转速反馈到控制系统中,控制量输出以PWM方式调节,驱动永磁无刷直流电动机按照设定速度运转,在搭建整体的实验平台,进行了基于PID和ADRC控制算法的无刷直流电机性能比较实验,分析出基于ADRC的无刷直流电机控制系统是有效的;基于ADRC的无刷直流电机控制系统较基于PID的无刷直流电机控制系统有更强的动态响应能力和抗扰动能力,这充分体现了ADRC控制算法的优越性,该系统具有良好的抗扰性能及动态响应性能,工程适用性较强。(The invention discloses a brushless direct current motor servo system software design method based on ADRC, which belongs to the technical field of brushless direct current motors, and is characterized in that through the design of a main program, the design of an interrupt program, a commutation program and a rotating speed calculation program, the software feeds the rotating speed of a motor back to a control system, the output of a control quantity is regulated in a PWM mode, a permanent magnet brushless direct current motor is driven to run according to a set speed, and a brushless direct current motor performance comparison experiment based on PID and ADRC control algorithms is carried out after an integral experiment platform is built, so that the fact that an ADRC-based brushless direct current motor control system is effective is analyzed; compared with a brushless direct current motor control system based on PID, the brushless direct current motor control system based on the ADRC has stronger dynamic response capability and disturbance resistance capability, so that the superiority of an ADRC control algorithm is fully reflected, and the system has good disturbance resistance performance and dynamic response performance and stronger engineering applicability.)

1. The ADRC-based brushless direct current motor servo system software design method is characterized by comprising the following steps of:

s1, overall software design: the DSP captures the height change of a Hall sensor signal through an eCAP interface, the output of an inverter bridge circuit is changed according to the signal, the design requirement of the motor is driven to run, when the eCAP is interrupted for 12 times, a motor rotor with the magnetic pole pair number of 2 rotates for one circle, and the rotating speed of the motor can be calculated by matching with the interruption times of a 10us timer;

the ADRC controller takes the PWM duty ratio as the output of a control system, takes the rotating speed of the motor as the feedback of a control object, and carries out control operation together with the set rotating speed, wherein the operation process is that the set rotating speed is calculated by a Tracking Differentiator (TD)First order tracking and second order differential V of output and input1、V2The extended state observer obtains first-order output tracking, second-order output differentiation and system interference of a system state through feedback (motor speed) of a controlled object and output (PWM duty ratio) of a control system, and then updates PWM duty ratio output through nonlinear combination (N L SEF);

s2, system initialization: the initialization comprises two parts, namely the initialization of a DSP chip and the initialization of a motor active module;

a. initializing a DSP chip: this program is an initialization routine provided by TI corporation for initializing internal modules and devices to a default state

1.initsysctrl();

Initializing system control, P LL, watchdog, enabling peripheral clock, this function is realized in dsp2833x _ sysctrl.C file;

2.initgpio();initxintf16gpio();

initializing GPI0 (general purpose input output interface), this function is implemented in the dsp2833x _ gpio.c file with the purpose of setting GPI0 to default state;

3.initpiectrl();

clearing the interrupt vector table, initializing the PIE: disabling the interruption of the CPU, and initializing a PIE control register to be in a system default state;

the default state is that all PIE interrupts and flags are clear, the function is implemented in dsp2833x _ piectrl.c;

disable interrupts for the CPU and clear all CPU interrupt flags:

IER=0x0000;

IFR=0x0000;

initpievecttable();

the function is implemented in dsp2833x _ pietect.c;

initializing an interrupt pointer and an Interrupt Service Routine (ISR) of a PIE vector table;

the program covers the whole table, which is beneficial to program debugging;

b. motor drive module initialization

Initializing a timer, timing and interrupting by taking 10us as a period, and then calculating the rotating speed of the motor by using the clock;

InitCpuTimers();

in this case, only the CPU clock is initialized

ConfigCpuTimer(&CpuTimer0,150,10);

A/150 MHZ CPU, a timing period of 10us, wherein the interrupt is used for judging the rotating speed of the motor, and in order to ensure the accuracy of timing, an interrupt service routine is simplified as much as possible and only has a clock counting function

StartCpuTimerO();

The initial Cap interface is used for capturing Hall sensor signals, and when any/any one of three Hall sensors of the motor changes, an interrupt program is entered to change the state of the switch tube

InitCapl();

V/initialize PWM Generator, set Carrier frequency and PWM mode of operation

EPwmSetup();

I/initialize AD sampling module

InitAdc();

// set interrupt

IER|=M_INT4;

IER|=M_INT1;

PieCtrlRegs.PIEIER4.bit.INTx1=1;

PieCtr1Regs.PIEIER4.bit.INTx2=1;

PieCtr1Regs.PIEIER4.bit.INTx3=1;

PieCtrlRegs.PIEIER1.bit.INTx6=1;

PieCtrlRegs.PIEIER1.bit.INTx7=1;

// turn on Global interrupts and real-time debug interrupts

EINT; // allowing global interrupts

ERTM; allowing real-time debug interrupts

c. ADRC parameter setting

(1) Tracking Differentiator (TD) parameter

r is a speed factor, and the tracking speed is determined; h0 is a filtering factor for filtering noise; h is the calculation step of the ADRC system discretization, and the same discretized step value is used in an extended state observer (ES0) and a Tracking Differentiator (TD); in order to conveniently modify the parameters of the controller in debugging, the actual numerical values are directly defined in a file;

#define tdh 0.5;

#define tdh0 0.5;

#define tdr 1;

then quoted in the program, such as:

fst1.h=tdh;

fst1.h0=tdh0;

fst1.r=tdr;

(2) extended State Observer (ESO) parameters

Adopting a fal () function in the ESO to correct the two, two and three states, wherein d is the upper and lower limits of the error of the fal function, and the fal function realizes small gain of the error larger than d and large gain of the error smaller than d; a1, b 1; a2 and b2. are parameters of the fal function, and determine the curve shape and the gain coefficient of the fal function;

b is a disturbance parameter, determines the anti-disturbance gain and determines according to the model of the control object; b1 and b2 substantially determine the performance of the ESO; the basic rule is as follows: b1 is smaller, z1 tracks the output y slower, but larger oscillations may occur; b2 is generally larger than b1, but too large causes z1 to overshoot too much; the larger a1, the smaller a2, the faster the reaction and the greater the overshoot;

esol.al=esoal;

esol.a2=esoa2;

eso1.b1=esobl;

esol.b2=esob2;

esol.b3=esob3;

esol.b=esob;

esol.d=esob;

(3) non-linear combination

PID respectively outputs through linear accumulation P, I, D to obtain a control quantity u, and a nonlinear combination (N L SEF) is adopted in ADRC to calculate a first-order error, a second-order error and a disturbance error to obtain the control quantity u, wherein the first-order error and the second-order error realize large-error small-gain and small-error large-gain through a fal function, and the disturbance error is independently set through a parameter b;

ctrl.b=esob;

ctr1.a1=ctra1;

ctr1.a2=ctra2;

ctr1.b1=ctrb1;

ctr1.b2=ctrb2;

s3, timing interruption and AD conversion algorithm:

the timer is set to be 10us once, which mainly provides a timing function, for example, when the motor rotates for 1 circle, the rotating Speed of the motor can be obtained by calculating the number of 10us interrupts, the Count in the software is the number of interrupts, and the rotating Speed formula is Speed (revolution/minute) =60 × 105/Count;

the ADC module of the TMS320F28335 is a 12-bit analog-to-digital converter with a pipeline, has 16 input channels, can be configured into independent 8 channels required by two eCAP modules, and can be cascaded into a 16-channel module; the ADC clock frequency is 12.5MHz, and the conversion speed is high; the ADC module comprises a 12-bit ADC conversion core and a sampling/holding circuit; the voltage that the ADC module can convert is 0-3V, and the relation between the sampling result and the input voltage is as follows: converted digital value =4095 (input analog voltage-ADC)/3;

s4, rotor position calculation and switching tube state:

the system adopts a Hall element to determine the current position of the rotor; the stator of the DC brushless motor is provided with 3 Hall position sensors which are distributed on the circumference of the stator at intervals of 120 degrees; when a permanent magnet rotor of the motor rotates, a generated magnetic field also rotates, and the magnetic pole change of the rotating magnetic field can generate an output signal with the width of 180 degrees on the Hall element, as shown in FIG. 2;

the DSP captures the output signal of the Hall element through an eCAP interface and converts the output signal into a switching tube state table of the inverter, as shown in figure 3;

s5, a speed loop active disturbance rejection control algorithm:

the speed loop active disturbance rejection control is to firstly carry out tracking differentiation on an input set value to obtain a set speed tracking value V1And second order differential value V2Then the output of the motor speed and the control quantity is fed back to an extended state observer of the controller to obtain the tracking Z of the current output1Differential Z2And a disturbance componentZ3

Output tracking Z in non-linear combination (N L SEF)1Tracking with set speed V1Are compared, differentiated by Z2And the input differential Z2Comparing to obtain error e1And e2By nonlinear combination e1、e2And Z3Obtaining the control quantity output and finishing the closed-loop control for one time;

the structure of ADRC simulink is shown in FIG. 4;

the ADRC algorithm block diagram is shown in fig. 5.

2. The ADRC-based brushless DC motor servo system software design method of claim 1, wherein: the motor power in the timed interruption and AD conversion algorithm is small, the requirement on voltage and current detection is not high, the sampling setting of the A/D conversion of the TI routine is adopted, the overvoltage and overcurrent are judged not to be generated after AD sampling every time, and then the motor control is carried out.

3. The ADRC-based brushless DC motor servo system software design method of claim 1, wherein: the corresponding relation between the output of the Hall element and the switch tube is listed in the comparison table of the Hall sensor and the switch tube, and the corresponding relation is determined when the motor is manufactured; wherein Q1-Q2; Q3-Q4; Q5-Q6 are geminate transistors respectively, and only one geminate transistor in a group of geminate transistors is conducted at any time; after the Hall element is installed in the motor, the states of 000 and 111 can not occur under the influence of a magnetic field; the switching state of the tube can be determined according to the output state of the Hall element, and the rectangular wave is input to a stator coil of the motor; the program uses switch-case to control the motor output state:

hin and lin of switch (capstastus)/ir 2136 are reversed

{

case 1:

EPwm1Regs.AQCTLA.al1=0x90;EPwm1Regs.AQCSFRC.a11=0x8;

EPwm2Regs.AQCSFRC.all=0x0a;EPwm3Regs.AQCTLB. all=0x90;

EPwm3Regs.AQCSFRC.all=0x2;break;//h3 fall

case 2:

EPwmlRegs.AQCSFRC.all=0x2;EPwm1Regs.AQCTLB.al1=0x90;

EPwm2Regs.AQCTLA.all=0x90;EPwm2Regs.AQCSFRC.al1=0x8;

EPwm3Regs.AQCSFRC.all=0xA;break;//h1 fall

case 3

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLA.all=0x90;

EPwm2Regs.AQCSFRC.all=0x8;EPwm3Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCTLB.all=0x90;break;//h2 rise

case 4:

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLB.all=0x90;

EPwm2Regs.AQCSFRC.all=0x2;EPwm3Regs.AQCSFRC.all=0x8;

EPwm3Regs.AQCTLA.al1=0x90;break;//h2 fall

case 5:

EPwm1Regs.AQCSFRC.a11=0x8;EPwm1Regs.AQCTLA.al1=0x90;

EPwm2Regs.AQCTLB.al1=0x90;EPwm2Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCSFRC.a1l=0xA;break;//h1 rise

case 6:

EPwm1Regs.AQCTLB.al1=0x90;EPwm1Regs.AQCSFRC.al1=0x2;

EPwm2Regs.AQCSFRC.a11=0x0a;EPwm3Regs.AQCTLA.a11=0x90;

EPwm3Regs.AQCSFRC.al1=0x8;break;//h3 rise

}

Since the number of pole pairs of the motor is 2, in one hall cycle (e.g. 001-;

the actual rotating speed is calculated once after 12 times of CAP interruption, and a rotating speed formula is unchanged: speed (revolution/minute) =60X105/count。

Technical Field

The invention belongs to the technical field of brushless direct current motors, and particularly relates to a brushless direct current motor servo system software design method based on ADRC.

Background

The permanent magnet brushless direct current motor not only has the advantages of simple structure, reliable operation, convenient maintenance and the like of the alternating current motor, but also has the characteristics of high operation efficiency, good speed regulation performance and the like of the direct current motor. With the rapid development of modern power electronics and computer technology, the hardware cost is effectively controlled, and the application of the method in the daily industrial field is increasingly wide, such as the application in electric vehicles and servo drivers.

The permanent magnet brushless direct current motor is a nonlinear multivariable system, and a mathematical model is difficult to establish. Classical PID control makes it difficult to achieve precise control of the motor. Compared with advanced model reference adaptive control, fuzzy control and neural network control, although the running performance of the motor can be effectively improved, the model reference adaptive control is difficult to deal with the rapid change of the load; fuzzy control causes the control effect to be not ideal due to the interaction of complex fuzzy rules; the neural network controller needs a high-speed microprocessor to perform data operation, and hardware implementation is difficult. Therefore, attempts have been made to study controllers for permanent magnet brushless dc motor systems using Active Disturbance Rejection Control (ADRC) technology.

The Active Disturbance Rejection Control (ADRC) technology is a novel nonlinear controller independent of a system model, and starts from classical PID control, system closed-loop control is established in an error negative feedback mode, disturbance inside and outside an extended state observer observation system is established by utilizing an observer theory of a modern control theory, and then corresponding control quantity is added to suppress the disturbance. The Active Disturbance Rejection Control (ADRC) technology inherits the advantages of PID, has the characteristics of low overshoot, high convergence rate, high precision, strong anti-interference capability and the like, and has strong adaptivity and robustness to uncertain disturbance and self-disturbance in a control object.

Disclosure of Invention

Technical problem to be solved

In order to overcome the defects in the prior art, the invention provides a brushless direct current motor servo system software design method based on ADRC, and solves the problems that the traditional PID control draws the error between input setting and system feedback output, the error obtained when the input setting changes can change in an order of magnitude mode by making a control signal after gain, and further the contradiction between the response rapidity and the overshoot of system design is caused.

(II) technical scheme

In order to achieve the purpose, the invention provides the following technical scheme: the ADRC-based brushless direct current motor servo system software design method comprises the following steps:

s1, overall software design: the DSP captures the height change of the Hall sensor signal through an eCAP interface, the output of the inverter bridge circuit is changed according to the signal, the design requirement operation of the motor is driven, when the eCAP is interrupted for 12 times, the rotor of the motor with the magnetic pole pair number of 2 rotates for one circle, and the rotation speed of the motor can be calculated by matching with the interruption times of a 10us timer.

The ADRC controller takes the PWM duty ratio as the output of a control system, takes the rotating speed of the motor as the feedback of a control object, and carries out control operation together with the set rotating speed, wherein the operation process is that the set rotating speed calculates the first-order tracking and second-order differential V of the input through a Tracking Differentiator (TD)1、V2The extended state observer obtains the first-order output tracking, the second-order output differential and the system disturbance of the system state through the feedback (motor speed) of the controlled object and the output (PWM duty ratio) of the control system, and then updates the PWM duty ratio output through nonlinear combination (N L SEF).

S2, system initialization: the initialization comprises two parts, namely the initialization of a DSP chip and the initialization of a motor active module.

a. Initializing a DSP chip: this program is an initialization routine provided by TI corporation for initializing internal modules and devices to a default state

1.initsysctrl();

P LL, watchdog, peripheral clock enabled, this function being implemented in the dsp2833x _ sysctrl.c file.

2.initgpio();initxintf16gpio();

GPI0 (general purpose input output interface) is initialized, and this function is implemented in the dsp2833x _ gpio.c file with the aim of setting GPI0 to the default state.

3.initpiectrl();

Clearing the interrupt vector table, initializing the PIE: and disabling the interruption of the CPU, and initializing the PIE control register to be in a system default state.

The default state is that all PIE interrupts and flags are clear and the function is implemented in dsp2833x _ piectrl.c.

Disabling interrupts for the CPU and clearing all CPU interrupt flags.

IER=0x0000;

IFR=0x0000;

initpievecttable();

The function is implemented in dsp2833x _ pietect.c.

The PIE vector table interrupt pointer and Interrupt Service Routine (ISR) are initialized.

The program will cover the whole table, facilitating program debugging.

b. Motor drive module initialization

A timer is initialized, and the timer is interrupted in a cycle of 10us, and then the motor speed is calculated by the clock.

InitCpuTimers();

In this case, only the CPU clock is initialized

ConfigCpuTimer(&CpuTimer0,150,10);

A/150 MHZ CPU, a timing period of 10us, wherein the interrupt is used for judging the rotating speed of the motor, and in order to ensure the accuracy of timing, an interrupt service routine is simplified as much as possible and only has a clock counting function

StartCpuTimerO();

The initial Cap interface is used for capturing Hall sensor signals, and when any/any one of three Hall sensors of the motor changes, an interrupt program is entered to change the state of the switch tube

InitCapl();

V/initialize PWM Generator, set Carrier frequency and PWM mode of operation

EPwmSetup();

I/initialize AD sampling module

InitAdc();

// set interrupt

IER|=M_INT4;

IER|=M_INT1;

PieCtrlRegs.PIEIER4.bit.INTx1=1;

PieCtr1Regs.PIEIER4.bit.INTx2=1;

PieCtr1Regs.PIEIER4.bit.INTx3=1;

PieCtrlRegs.PIEIER1.bit.INTx6=1;

PieCtrlRegs.PIEIER1.bit.INTx7=1;

// turn on Global interrupts and real-time debug interrupts

EINT; // allowing global interrupts

ERTM; allowing real-time debug interrupts

c. ADRC parameter setting

(1) Tracking Differentiator (TD) parameter

r is a speed factor, and the tracking speed is determined; h0 is a filtering factor for filtering noise; h is the calculation step of the ADRC system discretization, and the same discretized step value is used in an extended state observer (ES0) and a Tracking Differentiator (TD); to facilitate modification of the controller parameters during debugging, the actual values are first defined directly in the file.

#define tdh 0.5;

#define tdh0 0.5;

#define tdr 1;

Then quoted in the program, such as:

fst1.h=tdh;

fst1.h0=tdh0;

fst1.r=tdr;

(2) extended State Observer (ESO) parameters

Adopting a fal () function in the ESO to correct the two, two and three states, wherein d is the upper and lower limits of the error of the fal function, and the fal function realizes small gain of the error larger than d and large gain of the error smaller than d; a1, b 1; a2, b2. are parameters of the fal function, which determine the curve shape and gain factor of the fal function. b is a disturbance parameter, determines the anti-disturbance gain and determines according to the model of the control object; b1 and b2 substantially determine the performance of the ESO; the basic rule is as follows: b1 is smaller, z1 tracks the output y slower, but larger oscillations may occur; b2 is generally larger than b1, but too large causes z1 to overshoot too much; the larger a1, the smaller a2, the faster the reaction and the greater the overshoot.

esol.al=esoal;

esol.a2=esoa2;

eso1.b1=esobl;

esol.b2=esob2;

esol.b3=esob3;

esol.b=esob;

esol.d=esob;

(3) Non-linear combination

PID respectively outputs by linear accumulation P, I, D to obtain a control quantity u, a nonlinear combination (N L SEF) is adopted in ADRC to calculate a first-order error, a second-order error and a disturbance error to obtain the control quantity u, the first-order error and the second-order error realize large-error small-gain and small-error large-gain through a fal function, the disturbance error is independently set through a parameter b, a1, a2, b1 and b2 adjust a response curve of the fal function, and an error parameter d of the nonlinear combination adopts d of eso.

ctrl.b=esob;

ctr1.a1=ctra1;

ctr1.a2=ctra2;

ctr1.b1=ctrb1;

ctr1.b2=ctrb2;

S3, timing interruption and AD conversion algorithm:

the timer is set to be 10us once, which mainly provides a timing function, for example, when the motor rotates for 1 turn, the number of times of 10us interruption is calculated to obtain the rotating Speed of the motor, and Count in software is the number of times of interruption, and the rotating Speed formula is Speed (revolution/minute) 60 × 105/Count.

The ADC module of the TMS320F28335 is a 12-bit analog-to-digital converter with a pipeline, has 16 input channels, can be configured into independent 8 channels required by two eCAP modules, and can be cascaded into a 16-channel module; the ADC clock frequency is 12.5MHz, and the conversion speed is high; the ADC module comprises a 12-bit ADC conversion core and a sampling/holding circuit; the voltage that the ADC module can convert is 0-3V, and the relation between the sampling result and the input voltage is as follows: the converted digital value is 4095 (input analog voltage-ADC)/3.

S4, rotor position calculation and switching tube state:

the system adopts a Hall element to determine the current position of the rotor; the stator of the DC brushless motor is provided with 3 Hall position sensors which are distributed on the circumference of the stator at intervals of 120 degrees; when the permanent magnet rotor of the motor rotates, the generated magnetic field also rotates, and the magnetic pole change of the rotating magnetic field can generate an output signal with the width of 180 degrees on the Hall element, as shown in FIG. 2.

The DSP captures the hall element output signal through the eCAP interface and converts it into a switching tube state table of the inverter, as shown in fig. 3.

S5, a speed loop active disturbance rejection control algorithm:

the speed loop active disturbance rejection control is to firstly carry out tracking differentiation on an input set value to obtain a set speed tracking value V1And second order differential value V2Then the output of the motor speed and the control quantity is fed back to an extended state observer of the controller to obtain the tracking Z of the current output1Differential Z2And a disturbance component Z3Output tracking Z in non-linear combination (N L SEF)1Tracking with set speed V1Are compared, differentiated by Z2And the input differential Z2Comparing to obtain error e1And e2By nonlinear combination e1、e2And Z3And obtaining the control quantity output to complete one-time closed-loop control.

The structure of ADRC simulink is shown in FIG. 4.

The ADRC algorithm block diagram is shown in fig. 5.

As a further scheme of the invention: the motor power in the timed interruption and AD conversion algorithm is small, the requirement on voltage and current detection is not high, the sampling setting of the A/D conversion of the TI routine is adopted, the overvoltage and overcurrent are judged not to be generated after AD sampling every time, and then the motor control is carried out.

As a further scheme of the invention: the corresponding relation between the output of the Hall element and the switch tube is listed in the comparison table of the Hall sensor and the switch tube, and the corresponding relation is determined when the motor is manufactured; wherein Q1-Q2; Q3-Q4; Q5-Q6 are geminate transistors respectively, and only one geminate transistor in a group of geminate transistors is conducted at any time; after the Hall element is installed in the motor, the states of 000 and 111 can not occur under the influence of a magnetic field; the switching state of the tube can be determined according to the output state of the Hall element, and the rectangular wave is input to a stator coil of the motor; the program uses switch-case to control the motor output state:

hin and lin of switch (capstastus)/ir 2136 are reversed

case 1:

EPwm1Regs.AQCTLA.al1=0x90;EPwm1Regs.AQCSFRC.a11=0x8;

EPwm2Regs.AQCSFRC.all=0x0a;EPwm3Regs.AQCTLB.all=0x90;

EPwm3Regs.AQCSFRC.all=0x2;break;//h3 fall

case 2:

EPwmlRegs.AQCSFRC.all=0x2;EPwm1Regs.AQCTLB.al1=0x90;

EPwm2Regs.AQCTLA.all=0x90;EPwm2Regs.AQCSFRC.al1=0x8;

EPwm3Regs.AQCSFRC.all=0xA;break;//h1 fall

case 3

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLA.all=0x90;

EPwm2Regs.AQCSFRC.all=0x8;EPwm3Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCTLB.all=0x90;break;//h2 rise

case 4:

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLB.all=0x90;

EPwm2Regs.AQCSFRC.all=0x2;EPwm3Regs.AQCSFRC.all=0x8;

EPwm3Regs.AQCTLA.al1=0x90;break;//h2 fall

case 5:

EPwm1Regs.AQCSFRC.a11=0x8;EPwm1Regs.AQCTLA.al1=0x90;

EPwm2Regs.AQCTLB.al1=0x90;EPwm2Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCSFRC.a1l=0xA;break;//h1 rise

case 6:

EPwm1Regs.AQCTLB.al1=0x90;EPwm1Regs.AQCSFRC.al1=0x2;

EPwm2Regs.AQCSFRC.a11=0x0a;EPwm3Regs.AQCTLA.a11=0x90;

EPwm3Regs.AQCSFRC.al1=0x8;break;//h3 rise

}

Since the number of motor pole pairs is 2, in one hall cycle (e.g. 001-. The actual rotating speed is calculated once after 12 times of CAP interruption, and a rotating speed formula is unchanged: speed (rotation/minute) 60X105/count。

(III) advantageous effects

Compared with the prior art, the invention has the beneficial effects that:

according to the ADRC-based brushless direct current motor servo system software design method, through the design of a main program, the design of an interrupt program, a phase change program and a rotating speed calculation program, the rotating speed of a motor is fed back to a control system by software, the output of a control quantity is regulated in a PWM mode, the permanent magnet brushless direct current motor is driven to operate according to a set speed, an integral experiment platform is built, a brushless direct current motor performance comparison experiment based on a PID (proportion integration differentiation) and ADRC control algorithm is carried out, and the fact that an ADRC-based brushless direct current motor control system is effective is analyzed; compared with a brushless direct current motor control system based on PID, the brushless direct current motor control system based on the ADRC has stronger dynamic response capability and disturbance resistance capability, so that the superiority of an ADRC control algorithm is fully reflected, and the system has good disturbance resistance performance and dynamic response performance and stronger engineering applicability.

Drawings

FIG. 1 is a flow chart of the system of the present invention;

FIG. 2 is a signal diagram of a Hall signal sensor according to the present invention;

FIG. 3 is a comparison table of the Hall sensor and the tube state of the switch according to the present invention;

FIG. 4 is a block diagram of ADRC simulink simulation of the present invention;

fig. 5 is a block diagram of the ADRC algorithm of the present invention.

Detailed Description

The technical solution of the present patent will be described in further detail with reference to the following embodiments.

As shown in fig. 1 to 5, the present invention provides a technical solution: the ADRC-based brushless direct current motor servo system software design method comprises the following steps:

s1, overall software design: the DSP captures the height change of the Hall sensor signal through an eCAP interface, the output of the inverter bridge circuit is changed according to the signal, the design requirement operation of the motor is driven, when the eCAP is interrupted for 12 times, the rotor of the motor with the magnetic pole pair number of 2 rotates for one circle, and the rotation speed of the motor can be calculated by matching with the interruption times of a 10us timer.

The ADRC controller takes the PWM duty ratio as the output of a control system, takes the rotating speed of the motor as the feedback of a control object, and carries out control operation together with the set rotating speed, wherein the operation process is that the set rotating speed calculates the first-order tracking and second-order differential V of the input through a Tracking Differentiator (TD)1、V2The extended state observer obtains the first-order output tracking, the second-order output differential and the system disturbance of the system state through the feedback (motor speed) of the controlled object and the output (PWM duty ratio) of the control system, and then updates the PWM duty ratio output through nonlinear combination (N L SEF).

S2, system initialization: the initialization comprises two parts, namely the initialization of a DSP chip and the initialization of a motor active module.

a. Initializing a DSP chip: this program is an initialization routine provided by TI corporation for initializing internal modules and devices to a default state

1.initsysctrl();

P LL, watchdog, peripheral clock enabled, this function being implemented in the dsp2833x _ sysctrl.c file.

2.initgpio();initxintf16gpio();

GPI0 (general purpose input output interface) is initialized, and this function is implemented in the dsp2833x _ gpio.c file with the aim of setting GPI0 to the default state.

3.initpiectrl();

Clearing the interrupt vector table, initializing the PIE: and disabling the interruption of the CPU, and initializing the PIE control register to be in a system default state.

The default state is that all PIE interrupts and flags are clear and the function is implemented in dsp2833x _ piectrl.c.

Disabling interrupts for the CPU and clearing all CPU interrupt flags.

IER=0x0000;

IFR=0x0000;

initpievecttable();

The function is implemented in dsp2833x _ pietect.c.

The PIE vector table interrupt pointer and Interrupt Service Routine (ISR) are initialized.

The program will cover the whole table, facilitating program debugging.

b. Motor drive module initialization

A timer is initialized, and the timer is interrupted in a cycle of 10us, and then the motor speed is calculated by the clock.

InitCpuTimers();

In this case, only the CPU clock is initialized

ConfigCpuTimer(&CpuTimer0,150,10);

A/150 MHZ CPU, a timing period of 10us, wherein the interrupt is used for judging the rotating speed of the motor, and in order to ensure the accuracy of timing, an interrupt service routine is simplified as much as possible and only has a clock counting function

StartCpuTimerO();

The initial Cap interface is used for capturing Hall sensor signals, and when any/any one of three Hall sensors of the motor changes, an interrupt program is entered to change the state of the switch tube

InitCapl();

V/initialize PWM Generator, set Carrier frequency and PWM mode of operation

EPwmSetup();

I/initialize AD sampling module

InitAdc();

// set interrupt

IER|=M_INT4;

IER|=M_INT1;

PieCtrlRegs.PIEIER4.bit.INTx1=1;

PieCtr1Regs.PIEIER4.bit.INTx2=1;

PieCtr1Regs.PIEIER4.bit.INTx3=1;

PieCtrlRegs.PIEIER1.bit.INTx6=1;

PieCtrlRegs.PIEIER1.bit.INTx7=1;

// turn on Global interrupts and real-time debug interrupts

EINT; // allowing global interrupts

ERTM; allowing real-time debug interrupts

c. ADRC parameter setting

(1) Tracking Differentiator (TD) parameter

r is a speed factor, and the tracking speed is determined; h0 is a filtering factor for filtering noise; h is the calculation step of the ADRC system discretization, and the same discretized step value is used in an extended state observer (ES0) and a Tracking Differentiator (TD); to facilitate modification of the controller parameters during debugging, the actual values are first defined directly in the file.

#define tdh 0.5;

#define tdh0 0.5;

#define tdr 1;

Then quoted in the program, such as:

fst1.h=tdh;

fst1.h0=tdh0;

fst1.r=tdr;

(2) extended State Observer (ESO) parameters

Adopting a fal () function in the ESO to correct the two, two and three states, wherein d is the upper and lower limits of the error of the fal function, and the fal function realizes small gain of the error larger than d and large gain of the error smaller than d; a1, b 1; a2, b2. are parameters of the fal function, which determine the curve shape and gain factor of the fal function. b is a disturbance parameter, determines the anti-disturbance gain and determines according to the model of the control object; b1 and b2 substantially determine the performance of the ESO; the basic rule is as follows: b1 is smaller, z1 tracks the output y slower, but larger oscillations may occur; b2 is generally larger than b1, but too large causes z1 to overshoot too much; the larger a1, the smaller a2, the faster the reaction and the greater the overshoot.

esol.al=esoal;

esol.a2=esoa2;

eso1.b1=esobl;

esol.b2=esob2;

esol.b3=esob3;

esol.b=esob;

esol.d=esob;

(3) Non-linear combination

PID respectively outputs by linear accumulation P, I, D to obtain a control quantity u, a nonlinear combination (N L SEF) is adopted in ADRC to calculate a first-order error, a second-order error and a disturbance error to obtain the control quantity u, the first-order error and the second-order error realize large-error small-gain and small-error large-gain through a fal function, the disturbance error is independently set through a parameter b, a1, a2, b1 and b2 adjust a response curve of the fal function, and an error parameter d of the nonlinear combination adopts d of eso.

ctrl.b=esob;

ctr1.a1=ctra1;

ctr1.a2=ctra2;

ctr1.b1=ctrb1;

ctr1.b2=ctrb2;

S3, timing interruption and AD conversion algorithm:

the timer is set to be 10us once, which mainly provides a timing function, for example, when the motor rotates for 1 turn, the number of times of 10us interruption is calculated to obtain the rotating Speed of the motor, and Count in software is the number of times of interruption, and the rotating Speed formula is Speed (revolution/minute) 60 × 105/Count.

The ADC module of the TMS320F28335 is a 12-bit analog-to-digital converter with a pipeline, has 16 input channels, can be configured into independent 8 channels required by two eCAP modules, and can be cascaded into a 16-channel module; the ADC clock frequency is 12.5MHz, and the conversion speed is high; the ADC module comprises a 12-bit ADC conversion core and a sampling/holding circuit; the voltage that the ADC module can convert is 0-3V, and the relation between the sampling result and the input voltage is as follows: the converted digital value is 4095 (input analog voltage-ADC)/3.

S4, rotor position calculation and switching tube state:

the system adopts a Hall element to determine the current position of the rotor; the stator of the DC brushless motor is provided with 3 Hall position sensors which are distributed on the circumference of the stator at intervals of 120 degrees; when the permanent magnet rotor of the motor rotates, the generated magnetic field also rotates, and the magnetic pole change of the rotating magnetic field can generate an output signal with the width of 180 degrees on the Hall element, as shown in FIG. 2.

The DSP captures the hall element output signal through the eCAP interface and converts it into a switching tube state table of the inverter, as shown in fig. 3.

S5, a speed loop active disturbance rejection control algorithm:

the speed loop active disturbance rejection control is to firstly carry out tracking differentiation on an input set value to obtain a set speed tracking value V1And second order differential value V2Then the output of the motor speed and the control quantity is fed back to an extended state observer of the controller to obtain the tracking Z of the current output1Differential Z2And a disturbance component Z3Output tracking Z in non-linear combination (N L SEF)1Tracking with set speed V1Are compared, differentiated by Z2And the input differential Z2Comparing to obtain error e1And e2By nonlinear combination e1、e2And Z3And obtaining the control quantity output to complete one-time closed-loop control.

The structure of ADRC simulink is shown in FIG. 4.

The ADRC algorithm block diagram is shown in fig. 5.

The motor power is low in the timed interruption and AD conversion algorithm, the requirement on voltage and current detection is not high, the sampling setting of the A/D conversion of the TI routine is adopted, the overvoltage and overcurrent are judged not to be generated after AD sampling every time, and then the motor control is carried out.

The corresponding relation between the output of the Hall element and the switch tube is listed in a comparison table of the Hall sensor and the switch tube, and the corresponding relation is determined when the motor is manufactured; wherein Q1-Q2; Q3-Q4; Q5-Q6 are geminate transistors respectively, and only one geminate transistor in a group of geminate transistors is conducted at any time; after the Hall element is installed in the motor, the states of 000 and 111 can not occur under the influence of a magnetic field; the switching state of the tube can be determined according to the output state of the Hall element, and the rectangular wave is input to a stator coil of the motor; the program uses switch-case to control the motor output state:

hin and lin of switch (capstastus)/ir 2136 are reversed

case 1:

EPwm1Regs.AQCTLA.al1=0x90;EPwm1Regs.AQCSFRC.a11=0x8;

EPwm2Regs.AQCSFRC.all=0x0a;EPwm3Regs.AQCTLB.all=0x90;

EPwm3Regs.AQCSFRC.all=0x2;break;//h3 fall

case 2:

EPwmlRegs.AQCSFRC.all=0x2;EPwm1Regs.AQCTLB.al1=0x90;

EPwm2Regs.AQCTLA.all=0x90;EPwm2Regs.AQCSFRC.al1=0x8;

EPwm3Regs.AQCSFRC.all=0xA;break;//h1 fall

case 3

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLA.all=0x90;

EPwm2Regs.AQCSFRC.all=0x8;EPwm3Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCTLB.all=0x90;break;//h2 rise

case 4:

EPwm1Regs.AQCSFRC.all=0xA;EPwm2Regs.AQCTLB.all=0x90;

EPwm2Regs.AQCSFRC.all=0x2;EPwm3Regs.AQCSFRC.all=0x8;

EPwm3Regs.AQCTLA.al1=0x90;break;//h2 fall

case 5:

EPwm1Regs.AQCSFRC.a11=0x8;EPwm1Regs.AQCTLA.al1=0x90;

EPwm2Regs.AQCTLB.al1=0x90;EPwm2Regs.AQCSFRC.all=0x2;

EPwm3Regs.AQCSFRC.a1l=0xA;break;//h1 rise

case 6:

EPwm1Regs.AQCTLB.al1=0x90;EPwm1Regs.AQCSFRC.al1=0x2;

EPwm2Regs.AQCSFRC.a11=0x0a;EPwm3Regs.AQCTLA.a11=0x90;

EPwm3Regs.AQCSFRC.al1=0x8;break;//h3 rise

}

Since the number of motor pole pairs is 2, in one hall cycle (e.g. 001-. The actual rotating speed is calculated once after 12 times of CAP interruption, and a rotating speed formula is unchanged: speed (rotation/minute) 60X105/count。

Through the design of a main program, the design of an interruption program, the design of a phase change program and the design of a rotating speed calculation program, the rotating speed of a motor is fed back to a control system by software, the output of a control quantity is adjusted in a PWM mode, the permanent magnet brushless direct current motor is driven to operate according to a set speed, a comparison experiment of the performances of the brushless direct current motor based on a PID (proportion integration differentiation) and ADRC (adaptive digital control) control algorithm is carried out on an integral experiment platform, and the fact that the ADRC-based brushless direct current motor control system is effective is analyzed; compared with a brushless direct current motor control system based on PID, the brushless direct current motor control system based on the ADRC has stronger dynamic response capability and disturbance resistance capability, so that the superiority of an ADRC control algorithm is fully reflected, and the system has good disturbance resistance performance and dynamic response performance and stronger engineering applicability.

Although the preferred embodiments of the present patent have been described in detail, the present patent is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present patent within the knowledge of those skilled in the art.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种电机驱动系统及车辆

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!