Skip to content

Commit 47429a2

Browse files
committed
Merge branch 'dev' of https://github.com/simplefoc/Arduino-FOC.git into dev
2 parents 13a389d + 3d142b7 commit 47429a2

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/common/pid.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ PIDController::PIDController(float P, float I, float D, float ramp, float limit)
99
, error_prev(0.0f)
1010
, output_prev(0.0f)
1111
, integral_prev(0.0f)
12-
, integral_antiwindup_prev(0.0f)
1312
{
1413
timestamp_prev = _micros();
1514
}
@@ -30,10 +29,9 @@ float PIDController::operator() (float error){
3029
// Tustin transform of the integral part
3130
// u_ik = u_ik_1 + I*Ts/2*(ek + ek_1)
3231
// method uses the antiwindup Foxboro method : https://core.ac.uk/download/pdf/289952713.pdf
33-
float integral = integral_prev + I*Ts*0.5f*(error + error_prev) - integral_antiwindup_prev*I;
32+
float integral = integral_prev + I*Ts*0.5f*(error + error_prev);
3433
// antiwindup - limit the output
35-
float integral_constrained = _constrain(integral, -limit, limit);
36-
integral_antiwindup_prev = integral - integral_constrained;
34+
integral = _constrain(integral, -limit, limit);
3735
// Discrete derivation
3836
// u_dk = D(ek - ek_1)/Ts
3937
float derivative = D*(error - error_prev)/Ts;

src/common/pid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class PIDController
3434
float error_prev; //!< last tracking error value
3535
float output_prev; //!< last pid output value
3636
float integral_prev; //!< last integral component value
37-
float integral_antiwindup_prev; //!< last integral antiwindup component value
3837
unsigned long timestamp_prev; //!< Last execution timestamp
3938
};
4039

0 commit comments

Comments
 (0)