pid_implementation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
pid_implementation [2016/05/17 15:01] – [Proportional] coolstage | pid_implementation [2018/05/22 10:33] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== PID Implementation ====== | ||
+ | The PID controller use proportional, | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Proportional ===== | ||
+ | |||
+ | < | ||
+ | Proportional = Proportional_gain * (Consigne - Reference) | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | |||
+ | ===== Integral ===== | ||
+ | |||
+ | < | ||
+ | if Integral_gain == 0 | ||
+ | Integral = 0 | ||
+ | else | ||
+ | Integral = Integral_gain * (Consigne - Reference) + Previous_integral_gain_sum | ||
+ | | ||
+ | We saturate the integral term with uIAntiWU_Limit | ||
+ | |||
+ | if Integral > uIAntiWU_Limit | ||
+ | Integral = uIAntiWU_Limit | ||
+ | if Integral < -uIAntiWU_Limit | ||
+ | Integral = -uIAntiWU_Limit | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | ===== Derivative ===== | ||
+ | |||
+ | < | ||
+ | Derivative = Derivative_gain * (Error - Previous_error) with Error = (Consigne - Reference) | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | |||
+ | ===== Output Derivative ===== | ||
+ | |||
+ | < | ||
+ | Output_Derivative = Output_derivative_gain * (PID_Output - Previous_PID_output) | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | |||
+ | ===== PID Output ===== | ||
+ | |||
+ | < | ||
+ | (Proportional + Integral + Derivative + Output_Derivative) / Fixed_point_divider | ||
+ | </ | ||
+ | ---- |