Hi all,
I try to configure a P-Controller, but I have problems with the
anti-windup logic:
My controller looks like this
<pid-controller>
<name>Test controller</name>
<debug>true</debug>
<enable>
<prop>/autopilot/test/status</prop>
<value>go</value>
</enable>
<input>
<prop>/autopilot/test/input</prop>
</input>
<reference>
<prop>/autopilot/test/reference</prop>
</reference>
<output>
<prop>/autopilot/test/output</prop>
</output>
<config>
<Kp>-1</Kp> <!-- proportional gain -->
<beta>1</beta> <!-- input value weighing factor -->
<alpha>1</alpha> <!-- low pass filter weighing factor -->
<gamma>0.0</gamma> <!-- input value weighing factor for -->
<!-- unfiltered derivative error -->
<Ti>0</Ti> <!-- integrator time -->
<Td>0</Td> <!-- derivator time -->
<u_min>-100.0</u_min> <!-- minimum output clamp -->
<u_max>100.0</u_max> <!-- maximum output clamp -->
</config>
</pid-controller>
When I change the input value from 0 to to 150, the output value is 0
Updating Test controller
input = 0 ref = 0
ep_n = 0 ep_n_1 = 0 e_n = 0 ed_n = 0 delta_u_n = -0
P:-0 I:nan D:-0
output = 0
Updating Test controller
input = 0 ref = 0
ep_n = 0 ep_n_1 = 0 e_n = 0 ed_n = 0 delta_u_n = -0
P:-0 I:nan D:-0
output = 0
Updating Test controller
input = 150 ref = 0
ep_n = -150 ep_n_1 = 0 e_n = -150 ed_n = -150 delta_u_n = 150
P:150 I:inf D:0
max saturation
output = 0
Updating Test controller
input = 150 ref = 0
ep_n = -150 ep_n_1 = -150 e_n = -150 ed_n = -150 delta_u_n = -0
P:-0 I:inf D:-0
output = 0
Updating Test controller
input = 150 ref = 0
ep_n = -150 ep_n_1 = -150 e_n = -150 ed_n = -150 delta_u_n = -0
P:-0 I:inf D:-0
output = 0
Updating Test controller
input = 150 ref = 0
ep_n = -150 ep_n_1 = -150 e_n = -150 ed_n = -150 delta_u_n = -0
P:-0 I:inf D:-0
output = 0
Now u_n_1 = 0, so delta_u_n = 150 and greater as u_max,
and then u_n = 0 + 0 = 0. The controller does not work.
// Integrator anti-windup logic:
if ( delta_u_n > (u_max - u_n_1) ) {
delta_u_n = 0;
if ( debug ) cout << " max saturation " << endl;
} else if ( delta_u_n < (u_min - u_n_1) ) {
delta_u_n = 0;
if ( debug ) cout << " min saturation " << endl;
}
// Calculates absolute output:
u_n = u_n_1 + delta_u_n;
if ( debug ) cout << " output = " << u_n << endl;
I think, this is not okay. delta_u_n = 0; has to be replaced by
something like that
delta_u_n=u_max - u_n_1;
But that's not enough. The value of ep_n also has to be changed,
but I do not know how. Any ideas ?????
Kind regards
Hans-Georg
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d