Position-type PID analysis and parameter setting

Source: Internet
Author: User
Balanced trolley and inverted pendulum are used position-type PID controller/************************************************************************** function function: Position-type PID controller 1. Entry parameters: Encoder measurement position information, target position 2. Inlet parameters: Encoder measurement speed, target speed return value: Motor PWM based on position discrete PID Formula Pwm=kp*e (k) +ki*∑e (k) +kd[e (k)-E (k-1)] e (k) represents this deviation E ( K-1) represents the last deviation of ∑e (k) representing the accumulation of E (k) and prior deviations, where K is 1,2,,k; The PWM represents the output **************************************************************************/int Position_PID (int Encoder, int Target) {static float Bias,pwm,integral_bias,last_bias; Bias=encoder-target; Calculate deviation Integral_bias+=bias; The Integral pwm=position_kp*bias+position_ki*integral_bias+position_kd* (Bias-last_bias) to find out the deviation; Position-type PID controller last_bias=bias; Save the last deviation return Pwm; Incremental output}
P: Response speed too small response speed is too slow, basic non-oscillation; I: static difference when there is a static error when the I increase the point can be eliminated D: steady reduction of the maximum overshoot, the parameters of the general low-frequency Oscillation summary: p is used to improve the response speed, I used to reduce the static error, D used to suppress shock. L Maximum OvershootIs the difference between the maximum peak of response curve and the steady-state value, which is an important index to evaluate the stability of the system; l Rise TimeRefers to the response curve from the original working state, the first time to reach the output of the steady state value of the time required to assess the system is an important indicator of the speed; l Static DifferenceIs the difference between the stable value of the controlled quantity and the given value, which is generally used to measure the accuracy of the system,

The specific parameter debugging process: See position PID parameter control setting as follows: Kp=500,ki=0,kd=0. Response curve as shown










The above is the parameter tuning process of the position of the inlet parameter, the following is said that the entry parameter is the speed of the parameter tuning process:

For the position of the PID for debugging to achieve the target speed, the PI controller is sufficient, because if the addition of differential words will have a great jitter, so we generally use PI controller to debug speed. Specific parameters Tuning principle: First increase the proportion p,p small will not reach the target speed, will be much worse, so increase p, know the motor appears ' Click ' to shake or observe the waveform of the host computer when the sharp jitter, when P is too large, in fact, p can not be very large, such as 400, when the adjustment to increase the amplitude can be set to 20,i a little bit can be, balancing the car's engineering experience is ki=kp/ 200, but here I give is 0.01, but also to see the specific situation, the integration parameters are too large, the actual speed and target speed of the static difference will be very large.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.