main content

tuning of gain-凯发k8网页登录

this example uses systune to generate smooth gain schedules for a three-loop autopilot.

airframe model and three-loop autopilot

this example uses a three-degree-of-freedom model of the pitch axis dynamics of an airframe. the states are the earth coordinates $(x_e,z_e)$, the body coordinates $(u,w)$, the pitch angle $\theta$, and the pitch rate $q = \dot\theta$. the following figure summarizes the relationship between the inertial and body frames, the flight path angle $\gamma$, the incidence angle $\alpha$, and the pitch angle $\theta$.

we use a classic three-loop autopilot structure to control the flight path angle $\gamma$. this autopilot adjusts the flight path by delivering adequate bursts of normal acceleration $a_z$ (acceleration along $w$). in turn, normal acceleration is produced by adjusting the elevator deflection $\delta$ to cause pitching and vary the amount of lift. the autopilot uses proportional-integral (pi) control in the pitch rate loop $q$ and proportional control in the $a_z$ and $\gamma$ loops. the closed-loop system (airframe and autopilot) are modeled in simulink.

open_system('rct_airframegs')

autopilot gain scheduling

the airframe dynamics are nonlinear and the aerodynamic forces and moments depend on speed $v$ and incidence $\alpha$. to obtain suitable performance throughout the $(\alpha,v)$ flight envelope, the autopilot gains must be adjusted as a function of $\alpha$ and $v$ to compensate for changes in plant dynamics. this adjustment process is called "gain scheduling" and $\alpha,v$ are called the scheduling variables. in the simulink model, gain schedules are implemented as look-up tables driven by measurements of $\alpha$ and $v$.

gain scheduling is a linear technique for controlling nonlinear or time-varying plants. the idea is to compute linear approximations of the plant at various operating conditions, tune the controller gains at each operating condition, and swap gains as a function of operating condition during operation. conventional gain scheduling involves the following three major steps.

  1. trim and linearize the plant at each operating condition

  2. tune the controller gains for the linearized dynamics at each operating condition

  3. reconcile the gain values to provide smooth transition between operating conditions.

in this example, you combine steps 2 and 3 by parameterizing the autopilot gains as first-order polynomials in $\alpha,v$ and directly tuning the polynomial coefficients for the entire flight envelope. this approach eliminates step 3 and guarantees smooth gain variations as a function of $\alpha$ and $v$. moreover, the gain schedule coefficients can be automatically tuned with systune.

trimming and linearization

assume that the incidence $\alpha$ varies between -20 and 20 degrees and that the speed $v$ varies between 700 and 1400 m/s. when neglecting gravity, the airframe dynamics are symmetric in $\alpha$. therefore, consider only positive values of $\alpha$. use a 5-by-9 grid of linearly spaced $(\alpha,v)$ pairs to cover the flight envelope.

na = 5;  % number of alpha values
nv = 9;  % number of v values
[alpha,v] = ndgrid(linspace(0,20,na)*pi/180,linspace(700,1400,nv));

for each flight condition $(\alpha,v)$, linearize the airframe dynamics at trim (zero normal acceleration and pitching moment). this requires computing the elevator deflection $\delta$ and pitch rate $q$ that result in steady $w$ and $q$. to do this, first isolate the airframe model in a separate simulink model.

mdl = 'rct_airframetrim';
open_system(mdl)

use operspec to specify the trim condition, use findop to compute the trim values of $\delta$ and $q$, and linearize the airframe dynamics for the resulting operating points. for details, see trim and linearize an airframe (simulink control design). repeat these steps for the 45 flight conditions $(\alpha,v)$.

compute the trim condition for each $(\alpha,v)$ pair.

for ct=1:na*nv
   alpha_ini = alpha(ct);      % incidence [rad]
   v_ini = v(ct);              % speed [m/s]
   % specify trim condition
   opspec(ct) = operspec(mdl);
   % xe,ze: known, not steady
   opspec(ct).states(1).known = [1;1];
   opspec(ct).states(1).steadystate = [0;0];
   % u,w: known, w steady
   opspec(ct).states(3).known = [1 1];
   opspec(ct).states(3).steadystate = [0 1];
   % theta: known, not steady
   opspec(ct).states(2).known = 1;
   opspec(ct).states(2).steadystate = 0;
   % q: unknown, steady
   opspec(ct).states(4).known = 0;
   opspec(ct).states(4).steadystate = 1;
end
opspec = reshape(opspec,[na nv]);

trim the model for the given specifications.

options = findopoptions('displayreport','off');
op = findop(mdl,opspec,options);

linearize the model at the trim conditions.

g = linearize(mdl,op);
g.u = 'delta';
g.y = {'alpha','v','q','az','gamma','h'};
g.samplinggrid = struct('alpha',alpha,'v',v);

this process produces a 5-by-9 array of linearized plant models at the 45 flight conditions $(\alpha,v)$. the plant dynamics vary substantially across the flight envelope.

sigma(g)
title('variations in airframe dynamics')

tunable gain surface

the autopilot consists of four gains $k_p, k_i, k_a, k_g$ to be "scheduled" (adjusted) as a function of $\alpha$ and $v$. practically, this means tuning 88 values in each of the corresponding four look-up tables. rather than tuning each table entry separately, parameterize the gains as a two-dimensional gain surfaces, for example, surfaces with a simple multi-linear dependence on $\alpha$ and $v$:

$$ k(\alpha,v) = k_0   k_1 \alpha   k_2 v   k_3 \alpha v $$.

this cuts the number of variables from 88 down to 4 for each lookup table. use the tunablesurface object to parameterize each gain surface. note that:

  • tuninggrid specifies the "tuning grid" (design points). this grid should match the one used for linearization but needs not match the loop-up table breakpoints

  • shapefcn specifies the basis functions for the surface parameterization ($\alpha$, $v$, and $\alpha v$)

each surface is initialized to a constant gain using the tuning results for $\alpha$ = 10 deg and $v$ = 1050 m/s (mid-range design).

tuninggrid = struct('alpha',alpha,'v',v);
shapefcn = @(alpha,v) [alpha,v,alpha*v];
kp = tunablesurface('kp',0.1, tuninggrid,shapefcn);
ki = tunablesurface('ki',2, tuninggrid,shapefcn);
ka = tunablesurface('ka',0.001, tuninggrid,shapefcn);
kg = tunablesurface('kg',-1000, tuninggrid,shapefcn);

next create an sltuner interface for tuning the gain surfaces. use block substitution to replace the nonlinear plant model by the linearized models over the tuning grid. use setblockparam to associate the tunable gain surfaces kp, ki, ka, kg with the interpolation blocks of the same name.

blocksubs = struct('name','rct_airframegs/airframe model','value',g);
st0 = sltuner('rct_airframegs',{'kp','ki','ka','kg'},blocksubs);
% register points of interest
st0.addpoint({'az_ref','az','gamma_ref','gamma','delta'})
% parameterize look-up table blocks
st0.setblockparam('kp',kp,'ki',ki,'ka',ka,'kg',kg);

autopilot tuning

systune can automatically tune the gain surface coefficients for the entire flight envelope. use tuninggoal objects to specify the performance objectives:

  • $\gamma$ loop: track the setpoint with a 1 second response time, less than 2% steady-state error, and less than 30% peak error.

req1 = tuninggoal.tracking('gamma_ref','gamma',1,0.02,1.3);
viewgoal(req1)

  • $a_z$ loop: ensure good disturbance rejection at low frequency (to track acceleration demands) and past 10 rad/s (to be insensitive to measurement noise). the disturbance is injected at the az_ref location.

rejectionprofile = frd([0.02 0.02 1.2 1.2 0.1],[0 0.02 2 15 150]);
req2 = tuninggoal.gain('az_ref','az',rejectionprofile);
viewgoal(req2)

  • $q$ loop: ensure good disturbance rejection up to 10 rad/s. the disturbance is injected at the plant input delta.

req3 = tuninggoal.gain('delta','az',600*tf([0.25 0],[0.25 1]));
viewgoal(req3)

  • transients: ensure a minimum damping ratio of 0.35 for oscillation-free transients

mindamping = 0.35;
req4 = tuninggoal.poles(0,mindamping);

using systune, tune the 16 gain surface coefficients to best meet these performance requirements at all 45 flight conditions.

st = systune(st0,[req1 req2 req3 req4]);
final: soft = 1.13, hard = -inf, iterations = 57

the final value of the combined objective is close to 1, indicating that all requirements are nearly met. visualize the resulting gain surfaces.

% get tuned gain surfaces.
tgs = getblockparam(st);
% plot gain surfaces.
clf
subplot(2,2,1)
viewsurf(tgs.kp)
title('kp')
subplot(2,2,2)
viewsurf(tgs.ki)
title('ki')
subplot(2,2,3)
viewsurf(tgs.ka)
title('ka')
subplot(2,2,4)
viewsurf(tgs.kg)
title('kg')

validation

first validate the tuned autopilot at the 45 flight conditions considered above. plot the response to a step change in flight path angle and the response to a step disturbance in elevator deflection.

clf
subplot(2,1,1)
step(getiotransfer(st,'gamma_ref','gamma'),5)
grid
title('tracking of step change in flight path angle')
subplot(2,1,2)
step(getiotransfer(st,'delta','az'),3)
grid
title('rejection of step disturbance at plant input')

the responses are satisfactory at all flight conditions. next validate the autopilot against the nonlinear airframe model. first use writeblockvalue to apply the tuning results to the simulink model. this evaluates each gain surface formula at the breakpoints specified in the two prelookup blocks and writes the result in the corresponding interpolation block.

writeblockvalue(st)

simulate the autopilot performance for a maneuver that takes the airframe through a large portion of its flight envelope. the code below is equivalent to pressing the play button in the simulink model and inspecting the responses in the scope blocks.

% specify the initial conditions.
h_ini = 1000;
alpha_ini = 0;
v_ini = 700;
% simulate the model.
simout = sim('rct_airframegs', 'returnworkspaceoutputs', 'on');
% extract simulation data.
simdata = get(simout,'sigsout');
sim_gamma = getelement(simdata,'gamma');
sim_alpha = getelement(simdata,'alpha');
sim_v = getelement(simdata,'v');
sim_delta = getelement(simdata,'delta');
sim_h = getelement(simdata,'h');
sim_az = getelement(simdata,'az');
t = sim_gamma.values.time;
% plot the main flight variables.
clf
subplot(2,1,1)
plot(t,sim_gamma.values.data(:,1),'r--',t,sim_gamma.values.data(:,2),'b')
grid
legend('commanded','actual','location','southeast')
title('flight path angle \gamma in degrees')
subplot(2,1,2)
plot(t,sim_delta.values.data)
grid
title('elevator deflection \delta in degrees')

subplot(2,1,1)
plot(t,sim_alpha.values.data)
grid
title('incidence \alpha in degrees')
subplot(2,1,2)
plot(t,sim_v.values.data)
grid
title('speed v in m/s')

subplot(2,1,1)
plot(t,sim_h.values.data)
grid
title('altitude h in meters')
subplot(2,1,2)
plot(t,sim_az.values.data)
grid
title('normal acceleration a_z in g''s')

tracking of the flight path angle profile remains good throughout the maneuver. note that the variations in incidence $\alpha$ and speed $v$ cover most of the flight envelope considered here ([-20,20] degrees for $\alpha$ and [700,1400] for $v$). and while the autopilot was tuned for a nominal altitude of 3000 m, it fares well for altitude changing from 1,000 to 10,000 m.

the nonlinear simulation results confirm that the gain-scheduled autopilot delivers consistently high performance throughout the flight envelope. the "gain surface tuning" procedure provides simple explicit formulas for the gain dependence on the scheduling variables. instead of using look-up tables, you can use these formulas directly for an more memory-efficient hardware implementation.

see also

(simulink control design) | | (simulink control design)

related examples

    more about

      网站地图