主要内容

Tuning of Gain-Scheduled Three-Loop Autopilot

This example usessystune为三环自动驾驶仪生成平稳的增益计划。

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)$,身体协ates$(u,w)$, the pitch angle$\theta$, and the pitch rate$q = \dot\theta$。的following figure summarizes the relationship between the inertial and body frames, the flight path angle$ \ gamma $, the incidence angle$ \ alpha $和螺距角度$\theta$

We use a classic three-loop autopilot structure to control the flight path angle$ \ gamma $。该自动驾驶仪通过提供足够的正常加速爆发来调整飞行路径$ a_z $(acceleration along$w$)。In turn, normal acceleration is produced by adjusting the elevator deflection$\delta$导致俯仰和不同的升力。的autopilot uses Proportional-Integral (PI) control in the pitch rate loop$q$and proportional control in the$ a_z $and$ \ gamma $循环。闭环系统(机身和自动驾驶仪)在Simulink中建模。金宝app

open_system('rct_airframegs')

自动驾驶增益计划

的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. 调整每个工作条件下线性化动力学的控制器获得的控制器

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

在此示例中,您通过将自动驾驶仪增益作为一阶多项式组合来组合步骤2和3$ \ alpha,v $并直接调整整个飞行信封的多项式系数。这种方法消除了步骤3,并保证了平稳增益的变化作为$ \ alpha $and$V$。Moreover, the gain schedule coefficients can be automatically tuned withsystune

Trimming and Linearization

Assume that the incidence$ \ alpha $varies between -20 and 20 degrees and that the speed$V$在700至1400 m/s之间变化。当忽略重力时,机身动力学是对称的$ \ alpha $。的refore, 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 valuesnV = 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)

Useoperspecto specify the trim condition, usefindopto compute the trim values of$\delta$and$q$,并为产生的操作点线性化机身动力学。有关详细信息,请参阅Trim and Linearize an Airframe。重复45个飞行条件的这些步骤$(\alpha,V)$

Compute the trim condition for each$(\alpha,V)$pair.

forct=1:nA*nV alpha_ini = alpha(ct);% Incidence [rad]v_ini = V(ct);%速度[m/s]% Specify trim conditionopspec(ct)= operspec(mdl);% Xe,Ze: known, not steadyopspec(ct).States(1).Known = [1;1]; opspec(ct).States(1).SteadyState = [0;0];%u,w:已知,w稳定opspec(ct).States(3).Known = [1 1]; opspec(ct).States(3).SteadyState = [0 1];%theta:已知,不稳定opspec(ct).States(2).Known = 1; opspec(ct).States(2).SteadyState = 0;% q: unknown, steadyopspec(ct).States(4).Known = 0; opspec(ct).States(4).SteadyState = 1;endopspec = reshape(opspec,[nA nV]);

Trim the model for the given specifications.

Options = findopOptions('DisplayReport','离开');op = findop(mdl,opspec,Options);

在修剪条件下线性化模型。

G = linearize(mdl,op); G.u ='delta'; G.y = {'α','V','q','az','gamma','H'}; G.SamplingGrid = struct('α',alpha,'V',V);

此过程在45个飞行条件下生产5 x 9数线性化的植物模型$(\alpha,V)$。的plant dynamics vary substantially across the flight envelope.

sigma(G) title('Variations in airframe dynamics')

Tunable Gain Surface

的autopilot consists of four gains$K_p, K_i, K_a, K_g$作为“计划”(调整)作为$ \ alpha $and$V$。实际上,这意味着在相应的四个查找表中的每个查找表中调整88个值。与其分别调整每个表条目,不如将收益作为二维增益表面进行参数化,例如,具有简单多线性依赖性的表面$ \ 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 thetunableSurfaceobject to parameterize each gain surface. Note that:

  • TuningGrid指定“调整网格”(设计点)。该网格应匹配线性化的网格,但不需要与循环表断点匹配

  • shapefcnspecifies 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(中端设计)。

TuningGrid = struct('α',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('K a',0.001, TuningGrid,ShapeFcn); Kg = tunableSurface('Kg',-1000, TuningGrid,ShapeFcn);

Next create anslTunerinterface for tuning the gain surfaces. Use block substitution to replace the nonlinear plant model by the linearized models over the tuning grid. UsesetBlockParam关联可调增益表面Kp,Ki,Ka,Kgwith the Interpolation blocks of the same name.

BlockSubs = struct('Name','rct_airframegs/机身模型','Value',G);st0 = sltuner('rct_airframegs',{'Kp','Ki','K a','Kg'},BlockSubs);% Register points of interestST0.addPoint({'az_ref','az','gamma_ref','gamma','delta'})% Parameterize look-up table blocksST0.setBlockParam('Kp',KP,'Ki',Ki,'K a',Ka,'Kg',公斤);

自动驾驶调整

systunecan automatically tune the gain surface coefficients for the entire flight envelope. UseTuningGoalobjects 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 theAZ_REF地点。

排斥折叠= FRD([0.02 0.02 1.2 1.2 0.1],[0 0.02 2 15 150]);req2 = tuninggoal.gain('az_ref','az',拒绝折扣);ViewGoal(REQ2)

  • $q$循环:确保良好的干扰拒绝最多10 rad/s。在工厂输入处注入干扰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);

Usingsystune, 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

的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')子图(2,2,2)viewsurf(tgs.ki)标题(tgs.ki)标题('Ki') subplot(2,2,3) viewSurf(TGS.Ka) title('K a') subplot(2,2,4) viewSurf(TGS.Kg) title('Kg')

Validation

首先在上述45个飞行条件下验证调谐自动驾驶仪。绘制对飞行路径角度变化的响应,以及对电梯挠度中阶梯干扰的响应。

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)网格标题(“拒绝植物输入中的步骤干扰”)

在所有飞行条件下,响应都是令人满意的。接下来,针对非线性机身模型验证自动驾驶仪。首先使用writeBlockValue将调整结果应用于Simulink模型。金宝app这将评估每个增益表面公式在两个预序块中指定的断点,并在相应的插值块中写入结果。

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,'α');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(“命令”,'实际的','location','SouthEast') 标题('Flight path angle \gamma in degrees')子图(2,1,2)图(t,sim_delta.values.data)网格标题('Elevator deflection \delta in degrees')

subplot(2,1,1) plot(t,Sim_alpha.Values.Data) grid title('Incidence \alpha in degrees')子图(2,1,2)图(t,sim_v.values.data)网格标题('速度V中的M/S')

子图(2,1,1)图(t,sim_h.values.data)网格标题(“高度h,米”) 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 $和速度$V$cover most of the flight envelope considered here ([-20,20] degrees for$ \ alpha $and [700,1400] for$V$)。尽管自动驾驶仪的标称高度为3000 m,但对于从1,000 m变为10,000 m的高度来说,它的票房很好。

的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

||

Related Examples

More About