1
0
Fork 0

Added anti windup for the pi-simple-controller

This commit is contained in:
torsten 2010-03-10 21:02:57 +00:00 committed by Tim Moore
parent 881d49858d
commit f4f784a514

View file

@ -619,12 +619,15 @@ void FGPISimpleController::update( double dt ) {
int_sum += error * Ki.get_value() * dt; int_sum += error * Ki.get_value() * dt;
double output = prop_comp + int_sum;
double clamped_output = clamp( output );
if( output != clamped_output ) // anti-windup
int_sum = clamped_output - prop_comp;
if ( debug ) cout << "prop_comp = " << prop_comp if ( debug ) cout << "prop_comp = " << prop_comp
<< " int_sum = " << int_sum << endl; << " int_sum = " << int_sum << endl;
double output = prop_comp + int_sum; set_output_value( clamped_output );
output = clamp( output );
set_output_value( output );
if ( debug ) cout << "output = " << output << endl; if ( debug ) cout << "output = " << output << endl;
} }
} }