 /
/
/
Ren Yi Electric Encyclopedia: This article takes you to easily understand the essence of DC motor control algorithm

# Ren Yi Electric Encyclopedia: This article takes you to easily understand the essence of DC motor control algorithm

• Time:2020-07-09 16:01
• Visits:

(Summary description)Usually we do not know how to accurately control the trajectory of the car when controlling the movement of the car. When we don't understand the essence of the car control algorithm, we cannot control the car accurately. At present, most cars use PID control algorithm to realize the motion control of the cars. Nowadays, many players only know one adjustment method, which is proportional adjustment, that is, if you deviate to the left, you will adjust to the right, and if you deviate to the right, you will adjust to the left. There is a problem. The feeling at that time was that the car was too sensitive, and it was not very stable. After checking the information, I learned about other adjustment methods. The physical picture of the car is shown in the figure below.

# Ren Yi Electric Encyclopedia: This article takes you to easily understand the essence of DC motor control algorithm

(Summary description)Usually we do not know how to accurately control the trajectory of the car when controlling the movement of the car. When we don't understand the essence of the car control algorithm, we cannot control the car accurately. At present, most cars use PID control algorithm to realize the motion control of the cars. Nowadays, many players only know one adjustment method, which is proportional adjustment, that is, if you deviate to the left, you will adjust to the right, and if you deviate to the right, you will adjust to the left. There is a problem. The feeling at that time was that the car was too sensitive, and it was not very stable. After checking the information, I learned about other adjustment methods. The physical picture of the car is shown in the figure below.

• Categories:Industry News
• Author:任义
• Origin:http://www.scrydq.com
• Time of issue:2020-07-09 16:01
• Views:
Information
Usually we do not know how to accurately control the trajectory of the car when controlling the movement of the car. When we don't understand the essence of the car control algorithm, we cannot control the car accurately. At present, most cars use PID control algorithm to realize the motion control of the cars. Nowadays, many players only know one adjustment method, which is proportional adjustment, that is, if you deviate to the left, you will adjust to the right, and if you deviate to the right, you will adjust to the left. There is a problem. The feeling at that time was that the car was too sensitive, and it was not very stable. After checking the information, I learned about other adjustment methods. The physical picture of the car is shown in the figure below.

Figure Physical image of the car

Control algorithm:

The function of the motor control algorithm is to accept the command speed value, provide the appropriate drive voltage to the motor through calculation, and make the motor speed reach the command speed value as quickly and smoothly as possible, and maintain this speed value. In other words, once the motor speed reaches the command speed value, the speed value should remain unchanged even under the interference of various unfavorable factors (such as slopes, collisions, etc.) that make the motor speed change. In order to improve the control accuracy of the robot car control system, it is very necessary to select a suitable control algorithm. The control algorithm is the core of any closed-loop system control scheme. However, it is not that the more complex and accurate the algorithm is, the better, because the competition requires very high real-time performance, and the robot must respond sensitively in a very short time, so some modern ones Advanced control algorithms, such as fuzzy control and neural network control, cannot be applied to the car control system. This system has selected the most conventional and classic PID control algorithm, and achieved good results through practical applications. The figure below is the principle structure diagram of PID control.

Figure PID control system principle structure block diagram

1 proportional term

The first deviation conversion link in the control loop is the proportional term. This step simply multiplies the deviation signal by the constant K to get the new CV value (the value range is -100~100). The basic proportional control algorithm is as follows:

loop:

Error=SP-PV

CV=Error*Kprop

Setpwm(cv)

Goto loop

Among them, SP is the set value, PV is the feedback value, and Error is the error.

The SetPWM() function in the previous program does not treat the CV value as an absolute PWM duty cycle. Otherwise, the continuously decreasing deviation value will make the output value close to zero, and because the motor needs a continuous PWM signal when working, the control system will stabilize the motor in a low-speed running state, which will lead to the failure of the control system strategy.

On the contrary, the CV value is generally taken as the amount of change in the current PWM duty cycle, and is added to the current PWM duty cycle. This also requires the SetPWM() function to limit the PWM duty cycle obtained after the addition to 0%~100%. A positive CV value will increase the voltage across the motor. A negative CV value will reduce the voltage across the motor. If the CV value is equal to 0, there is no need to change the previous duty cycle. A lower K value will make the speed response of the motor slow, but it is very stable. A higher K value will make the speed response faster, but it may cause overshoot, that is, oscillation near the desired value before reaching a stable output. Too high K value will cause system instability, that is, the output will continue to oscillate and will not tend to the expected value.

2 points

Integral is the opposite of differential. If there is an expression describing the rate of change (differential), then the integration of this expression will yield the original physical quantity that changes with time. If the integral of acceleration is velocity, the integral of velocity is displacement.

In the PID control loop, the integral of the deviation represents the sum of all deviations accumulated since the start of control. This sum is multiplied by the constant K and added to the loop output. In the loop, if there is no integral link, although the control system will tend to be stable, the output value may not reach the SP value eventually for some reason.

The pseudo-code implementation of a simple but complete PID controller is as follows:

loop:

LastError=Error

Isum=Isum+Error

Error=SP-PV

Rate=Error-LastError

CV=Error*Kprop+Krate*Rate+Kint*Isum

SetPWM(CV)

Goto loop

Since the integral term will become larger and larger, this will slow down the response of the control loop when the SP value changes. Some applications will stop accumulating Isum when the CV value reaches the value boundary (for example: -100~100) . When the SP value changes, the Isum item can also be removed.

3 Differential term

The derivative term of any variable is used to describe how that variable changes relative to another variable (multi-bit time). In other words, the differential term of any variable is its rate of change over time. For example, the rate of change of displacement with time is speed. The differential of speed with respect to time is acceleration.

In a PID controller, it is worth paying attention to the differentiation of the deviation signal with respect to time, or the rate of change. Most controllers define the derivative term as:

Rate=(E-E )/T

In the formula, E is the current deviation, E is the previous deviation value, and T is the time interval between two measurements. A negative rate of change indicates an improvement in the deviation signal. When the derivative term is specifically applied to the controller, multiply a constant by the derivative term and add it to the proportional term to get the final CV value calculation formula:

CV=( K E)+( K Rate)

When the deviation signal is close to zero, the CV value will be negative, so when the deviation signal starts to improve, the effect of the differential term will gradually weaken the correction output. In some cases, the differential term is also conducive to the elimination of overshoot, and can allow the use of a larger K value, which can improve the speed of response. The differential link also indicates the trend of the deviation signal. When the control object responds slowly to the output of the controller, the effect of the differential link is particularly obvious.

The pseudo-code implementation of the control algorithm with differential term is as follows:

loop:

LastError=Error

Error=SP-PV

Rate=Error-LastError

CV=Error*Kprop+Krate*Rate

SetPWM(CV)

Goto loop

4 PID tuning method

When tuning the parameters of the PID controller, the parameters of the controller can be adjusted by experimental methods according to the qualitative relationship between the parameters of the controller and the dynamic performance and steady-state performance of the system. Experienced debugging personnel can generally obtain satisfactory debugging results quickly. The most important problem in debugging is to know which parameter should be adjusted and whether the parameter should be increased or decreased when the system performance is not satisfactory.

In order to reduce the parameters that need to be tuned, a PI controller can be used first. In order to ensure the safety of the system, relatively conservative parameters should be set at the beginning of debugging, for example, the proportional coefficient should not be too large, and the integral time should not be too small, so as to avoid abnormal conditions such as system instability or excessive overshoot. Given a step given signal, the system performance information can be obtained from the output waveform of the controlled quantity, such as overshoot and adjustment time. The PID parameters should be adjusted repeatedly according to the relationship between PID parameters and system performance.

If the overshoot of the step response is too large, it will be stable or fundamentally unstable after multiple oscillations, and the proportional coefficient should be reduced and the integral time increased. If the step response does not overshoot, but the controlled value rises too slowly and the transition process takes too long, the parameters should be adjusted in the opposite direction.

If the speed of eliminating errors is slow, the integration time can be reduced appropriately to enhance the integration effect.

Repeatedly adjust the proportional coefficient and integral time. If the overshoot is still large, you can add derivative control. The derivative time gradually increases from 0, and the controller's proportional, integral and derivative parameters are repeatedly adjusted.

In short, the debugging of PID parameters is a comprehensive process in which each parameter influences each other. Many attempts in the actual debugging process are very important and necessary.

There are several methods:

(1) Trial method

The trial and error method is to manually select the PID parameters to make the control system respond to the predetermined requirements. This method is simple and complicated. To put it simply, if you have experience and luck, then in SIMULINK, you may soon reach the goal. It is difficult to say that in actual combat, a lot of time and energy may have been spent adjusting the three parameters and the task was not completed.

(2) Critical proportion method

The critical proportionality method is to adjust the proportionality to make the system oscillate with constant amplitude only under the action of P, and then calculate the PID value according to the formula. The effect is shown in Figure 1. The left half of the figure is the system constant amplitude oscillation, and the right half is the control effect. The following figure is the curve effect diagram controlled by the PID critical proportionality method of MATLAB simulation.

Fig. 1 Control curve of PID critical proportionality method

(3) Attenuation curve method

The attenuation curve method is to adjust the proportionality to attenuate the system response curve at a ratio of 4:1 or 10:1 under the action of P only, and then calculate the PID value according to the formula. The effect is shown in Figure 2. The left half of the figure is the system attenuation The curve, the right half is the control effect. The following figure is the curve effect diagram controlled by the PID attenuation curve method of MATLAB simulation.

Sichuan Renyi Electric Co., Ltd. is registered under the name of Ren Yi, a senior technician for substation maintenance, and uses scientific research, knowledge innovation, publicity, promotion, and teaching that the temperature of electrical contacts (connectors) is lower than the temperature of its conductors (wires). The theory and technology of "thermal electrical contacts" produces and sells registered trademark electrical equipment that does not heat electrical contacts (joints), as a whole with patented products. ### Today talks about: Solving various electrical disasters from the source of electricity -

Mount Everest on Electricity [Today's Talk]: The difference between "heating" and "overheating"; the three stages of "Electrical Contact Overheating":
2019-11-18 ### 119 Safety and firefighting must be done practically. "Superconductivity" cannot solve man-made disasters such as electrical fires!

119 Safety and firefighting must be done practically. "Superconductivity" cannot solve man-made disasters such as electrical fires!
2019-11-09 ### Pay special attention to the power safety revolution forum, and Mount Everest discusses electricity-to solve the mystery of a century of electrical disasters in the world of man-made disasters! Solve and eradicate the global ...

2019-11-08 ### Special attention should be paid to national power safety in summer

History, tradition, and habit believe that: poor contact; weak electrical contacts (joints); electrical contacts whose temperature is higher than (exceeds) the temperature of its conductor (line). The theoretical concept of "electrical contacts overheating" is wrong! It is believed that oxidative corrosion (chemical, electrical corrosion) caused the "electrical contact overheating", which reverses the causality! Please go to the China Renyi Electric Platform (challenge) for academic discussion and debate!
2015-07-23

Email: 577538063@qq.com

Phone:+86 13438175710

128 Hongyang East Road, Qingbaijiang District, Chengdu

CHENGDU BRANCH

Room 3101, Tower 2, Raffles City, Wuhou

District, Chengdu,PR China

+86 13438175710
577538063@qq.com