|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#10
|
||||
|
||||
|
Re: paper: Take-Back-Half Shooter Wheel Speed Control
I think the following is a correct C implementation of Take-Back-Half: Code:
.
e = S-P; // calculate the error;
Y += G*e; // integrate the output;
if (Y>1) Y=1; else if (Y<0) Y=0; // clamp the output to 0..+1;
if (signbit(e)!=signbit(d)){ // if zero crossing,
Y = b = 0.5*(Y+b); // then Take Back Half
d = e;} // and save the previous error;
S is the setpoint (target RPM) P is the process variable (measured RPM) G is the integral gain (the tuning parameter) Y is the output command to the motor controller e is the error d is the previous error b is the TBH variable Y, d, and b should be initialized. Would someone be willing to test this and make any necessary corrections and re-post for the benefit of C language teams who might want to try TBH? |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|