Stepping motor driver based on fuzzy PID current loop control

文档序号:814338 发布日期:2021-03-26 浏览:19次 中文

阅读说明:本技术 一种基于模糊pid电流环控制的步进电机驱动器 (Stepping motor driver based on fuzzy PID current loop control ) 是由 杨红军 类课文 于 2020-11-30 设计创作,主要内容包括:本发明公开了一种基于模糊PID电流环控制的步进电机驱动器,包括以下控制步骤:S1:确定模糊控制器输入变量和输出变量,以及输入变量的变化范围;其中输入变量包括偏差E、偏差变化率EC;S2:通过整定确定模糊控制的量化等级、量化因子和比例因子;S3:得出模糊控制表:根据输入值和输出值分别得出比例系数Kp、积分时间常数Ki、微分时间常数Kd的模糊控制表;S4:计算模糊控制输出值;S5:计算模糊PID控制输出值:将偏差E和偏差变化率EC代入模糊控制表中,得出模糊PID参数Kp’、Ki’、Kd’,再将Kp’、Ki’、Kd’代入PID算法中计算出模糊PID控制输出值。(The invention discloses a stepping motor driver based on fuzzy PID current loop control, which comprises the following control steps: s1: determining input variables and output variables of the fuzzy controller and the variation range of the input variables; wherein the input variables include a deviation E, a deviation change rate EC; s2: determining the quantization grade, quantization factor and scale factor of the fuzzy control through setting; s3: and (3) obtaining a fuzzy control table: respectively obtaining a fuzzy control table of a proportional coefficient Kp, an integral time constant Ki and a differential time constant Kd according to the input value and the output value; s4: calculating a fuzzy control output value; s5: calculating a fuzzy PID control output value: substituting the deviation E and the deviation change rate EC into a fuzzy control table to obtain fuzzy PID parameters Kp ', Ki' and Kd ', and substituting Kp', Ki 'and Kd' into a PID algorithm to calculate a fuzzy PID control output value.)

1. The utility model provides a step motor driver based on fuzzy PID current loop control which characterized in that: the method comprises the following control steps:

s1: determining input variables and output variables of the fuzzy controller and the variation range of the input variables;

wherein the input variables include a deviation E, a deviation change rate EC;

s2: determining the quantization grade, quantization factor and scale factor of the fuzzy control through setting;

s3: and (3) obtaining a fuzzy control table: respectively obtaining a fuzzy control table of a proportional coefficient Kp, an integral time constant Ki and a differential time constant Kd according to the input value and the output value;

s4: calculating a fuzzy PID control output value: substituting the deviation E and the deviation change rate EC into a fuzzy control table to obtain fuzzy PID parameters Kp ', Ki' and Kd ', and substituting Kp', Ki 'and Kd' into a PID algorithm to calculate a fuzzy PID control output value:

kp is a proportional coefficient, Ki is an integral coefficient, Kd is a differential coefficient, E (k) and E (k-1) are deviation signals at the k-th time and the k-1-th time respectively, k is a sampling serial number, and T is sampling time.

2. The driver of the stepping motor based on the fuzzy PID current loop control as claimed in claim 1, wherein: the step S2 includes the following tuning sub-steps:

s21: determining a fuzzy subset of deviation E and deviation change rate EC through the membership degree;

s22: introducing discourse domains corresponding to fuzzy subsets of deviation E and deviation change rate EC;

s23: a quantization function is derived.

Technical Field

The invention relates to the field of motor drivers, in particular to a stepping motor driver based on fuzzy PID current loop control.

Background

The traditional PID control is based on an accurate mathematical model, can not effectively deal with uncertain information of a system, and cannot achieve a better control result by using unchanging PID parameters. The fuzzy control does not need an accurate mathematical model of an object, and is insensitive to system change, good in robustness and strong in anti-interference performance. But the steady state accuracy is not good due to its ambiguity.

Disclosure of Invention

The invention aims to provide a stepping motor driver based on fuzzy PID current loop control.

In order to achieve the purpose of the invention, the technical scheme adopted by the invention is as follows: a stepping motor driver based on fuzzy PID current loop control comprises the following control steps:

s1: determining input variables and output variables of the fuzzy controller and the variation range of the input variables;

wherein the input variables include a deviation E, a deviation change rate EC;

s2: determining the quantization grade, quantization factor and scale factor of the fuzzy control through setting;

s3: and (3) obtaining a fuzzy control table: respectively obtaining a fuzzy control table of a proportional coefficient Kp, an integral time constant Ki and a differential time constant Kd according to the input value and the output value;

s4: calculating a fuzzy PID control output value: substituting the deviation E and the deviation change rate EC into a fuzzy control table to obtain fuzzy PID parameters Kp ', Ki' and Kd ', and substituting Kp', Ki 'and Kd' into a PID algorithm to calculate a fuzzy PID control output value:

kp is a proportional coefficient, Ki is an integral coefficient, Kd is a differential coefficient, E (k) and E (k-1) are deviation signals at the k-th time and the k-1-th time respectively, k is a sampling serial number, and T is sampling time.

Preferably, the step S2 includes the following setting substeps:

s21: determining a fuzzy subset of deviation E and deviation change rate EC through the membership degree;

s22: introducing discourse domains corresponding to fuzzy subsets of deviation E and deviation change rate EC;

s23: a quantization function is derived.

The beneficial effects of the invention are concentrated and expressed as follows: the invention can effectively solve the problems of nonlinearity, interference and the like of a current control system of the stepping motor, and can realize automatic parameter change along with the change of the environment so as to achieve better control effect. And secondly, the driver runs stably, the current waveform is stable, the driver is accurately positioned, and various production costs are effectively saved.

Drawings

FIG. 1 is a control flow diagram of the present invention;

FIG. 2 is a block diagram of the control system of the present invention.

Detailed Description

In order to make the technical solutions of the present invention better understood by those skilled in the art, the present invention will be further described in detail with reference to the accompanying drawings and specific embodiments.

As shown in fig. 1 and 2, a stepper motor driver based on fuzzy PID current loop control comprises the following control steps:

s1: determining input variables and output variables of the fuzzy controller and the variation range of the input variables;

the input variables comprise deviation E, deviation change rate EC, input current and subdivision number of the motor, and proportion, integral and differential of motor setting; the input current and the subdivision number are determined by a dial switch, namely the dial switch can be used for adjusting the input current value of the driver; the proportion, the integral and the derivative are changed based on a set value from a determined basic value;

s2: determining the quantization grade, quantization factor and scale factor of the fuzzy control through setting;

specifically, step S2 includes the following tuning substeps:

s21: determining fuzzy subsets of deviation E and deviation change rate EC according to the membership degree, wherein the fuzzy subsets of deviation E and deviation change rate EC are { NB, NM, NS, ZO, PS, PM, PB }, wherein negative large [ NB ], negative middle [ NM ], negative small [ NS ], zero [ ZO ], positive small [ PS ], positive middle [ PM ] and positive large [ PB ];

the degree of membership is a value between 0 and 1, the degree of membership having the following relationship:

1. when a certain element u belongs to the set A, the element membership degree is 1;

2. when a certain element u does not belong to the set A, the membership degree of the element is 0;

3. when a certain element u belongs to the set A in part and does not belong to the set A in part, the membership degree of the element u to the A is a certain number in an open interval (0, 1);

s22: introducing a domain corresponding to the fuzzy subset of the deviation E and the deviation change rate EC, wherein the domain range is composed of the resistance and the inductance of various types of motors, and the domain is defined as follows in the embodiment: -6, -5, -4, -3, -2, -1, 0,1, 2, 3, 4, 5, 6 };

s23: and (3) obtaining a quantitative function of the deviation E and the deviation change rate EC: in FIG. 2, the measured signal of the current has a range of ranges, denoted as Vmax and Vmin, so the range of the deviation E is from Vmin-Vmax to Vmax-Vmin, and the incremental range of the deviation is twice as large:

the deviation E quantization function is then:

the quantitative function of the rate of change of deviation EC is:

e and EC can be quantified according to equation (1) and equation (2).

In the formula (3), Kp is a proportional coefficient, Ki is an integral coefficient, Kd is a differential coefficient, E (k) and E (k-1) are deviation signals at the k-th time and the k-1-th time respectively, k is a sampling serial number, and T is sampling time;

s3: and (3) obtaining a fuzzy control table: respectively obtaining a fuzzy control table of a proportional coefficient Kp, an integral time constant Ki and a differential time constant Kd according to the input value and the output value;

in a PID controller, the value of Kp is selected depending on the response speed of the system. Increasing Kp can improve the response speed and reduce the steady-state deviation; however, an excessive value of Kp may cause a large overshoot, and even decreasing Kp to make the system unstable may reduce overshoot and improve stability, but an insufficient value of Kp may slow down the response speed and prolong the adjustment time. Therefore, the initial adjustment stage should properly take a larger Kp value to improve the response speed, and in the middle adjustment stage, the Kp value should take a smaller value to ensure that the system has smaller overshoot and a certain response speed is ensured; and the Kp value is adjusted to a larger value at the later stage of the adjusting process to reduce the static difference and improve the control precision. The fuzzy control table defining Kp in this embodiment is therefore as follows:

kp fuzzy control table

In the system control, the integral control is mainly used for eliminating the steady-state deviation of the system. For some reasons (e.g., saturation non-linearity, etc.), the integration process may produce integral saturation early in the tuning process, thereby causing a large overshoot of the tuning process.

Therefore, in the early stage of the adjusting process, in order to prevent integral saturation, the integral effect should be weaker, and even zero can be taken;

in the middle stage of regulation, in order to avoid affecting stability, the integral action is moderate;

finally, at the end of the process, the integration should be enhanced to reduce the adjustment dead band.

From the above analysis, therefore, the Ki fuzzy control table is defined as follows in this embodiment:

ki fuzzy control table

The adjustment of the differential link is mainly introduced aiming at the process of large inertia, and the coefficient of the differential link has the function of changing the dynamic characteristic of the system. The differential link coefficient of the system can reflect the trend of signal change, and an effective early correction signal can be introduced into the system before the change of a deviation signal is too large, so that the response speed is accelerated, the adjustment time is shortened, the oscillation is eliminated, and finally the dynamic performance of the system is changed.

Therefore, the choice of Kd values has a large influence on the regulation dynamics. The Kd value is too large, the braking in the adjusting process is advanced, and the adjusting time is too long; with too small a Kd value, the braking will lag behind during the adjustment process, resulting in increased overshoot. According to the experience of the actual process, the differential action is increased at the initial stage of regulation, so that the overshoot is reduced or even avoided;

in the middle stage, the Kd value should be small and should be kept constant, since the regulation characteristic is sensitive to the change of the Kd value;

then, in the later stages of the regulation, the Kd value should be reduced to reduce the braking effect of the controlled process and thus compensate for the prolonged period of the regulation process caused by the larger Kd value in the early stages of the regulation process.

From the above analysis, the Kd fuzzy control table is thus defined in this embodiment as follows:

kd fuzzy control table

S4: calculating a fuzzy PID control output value: substituting the deviation E and the deviation change rate EC into a fuzzy control table to obtain fuzzy PID parameters Kp ', Ki' and Kd ', and substituting Kp', Ki 'and Kd' into a PID algorithm to calculate a fuzzy PID control output value;

such as: set the current to CsetThe current collected by AD is CtureThe current deviation is E (t) ═ Cset-CtureDeviation rate of change EC(t)=E(t)-E(t-1)(ii) a The current deviation E (t) and the deviation change rate EC(t)Taking Kp, Ki and Kd as output quantities, taking current value collected in real time as comparison quantity, and taking current deviation E (t) and deviation change rate EC(t)Substituting into fuzzy control table to obtain fuzzy PID parameter Kp', Ki', Kd ', and substituting Kp', Ki ', Kd' into PID algorithm to calculate fuzzy PID control output value:

kp is a proportional coefficient, Ki is an integral coefficient, Kd is a differential coefficient, E (k) and E (k-1) are deviation signals at the k-th time and the k-1-th time respectively, k is a sampling serial number, and T is sampling time.

The invention can effectively solve the problems of nonlinearity, interference and the like of a current control system of the stepping motor, and can realize automatic parameter change along with the change of the environment so as to achieve better control effect. And secondly, the driver runs stably, the current waveform is stable, the driver is accurately positioned, and various production costs are effectively saved.

It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and elements referred to are not necessarily required in this application.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数字切片扫描仪步进电机加减速的控制方法及装置

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!