obtain linearized models and control system responses, and push tuned values back to
Simulink.
For simple architectures and rapid design iterations, it can be preferable (and
conceptually simpler) to manipulate the linearized models in MATLAB and use basic
commands like feedback to close loops. This example shows how to perform the design
steps of Parts 2 and 3 in MATLAB.
Obtaining the Plant Models
To tune the autopilot, we need linearized models of the transfer function from deflections
to angular position and rates. To do this, start from the results from the "Trim and
Linearize" step (see “Trimming and Linearization of the HL-20 Airframe” (Control System
Toolbox)). Recall that G7 is a seven-state linear model of the airframe at 40 different
(alpha,beta) conditions, and CS is the linearization of the Controls Selector block.
load csthl20_TrimData G7 CS
Using the Simulink model "csthl20_trim" as reference for selecting I/Os, build the desired
plant models by connecting G7 and CS in series. Do not forget to convert phi,alpha,beta
from radians to degrees.
r2d = 180/pi;
G = diag([1 1 1 r2d r2d r2d]) G7([4:7 31:32],1:6) CS(:,1:3);
G.InputName = {'da','de','dr'};
G.OutputName = {'p','q','r','Phi_deg','Alpha_deg','Beta_deg'};
size(G)
8x5 array of state-space models.
Each model has 6 outputs, 3 inputs, and 7 states.
This gives us an array of plant models over the 8-by-5 grid of (alpha,beta) conditions used
for trimming.
Closing the Inner Loops
To close the inner loops, we follow the same procedure as in Part 2 (“Angular Rate Control
in the HL-20 Autopilot” (Control System Toolbox)). This consists of selecting the gain
Kp,Kq,Kr to set the crossover frequency of the p,q,r loops to 30, 22.5, and 37.5 rad/s,
respectively.
% Compute Kp,Kq,Kr for each (alpha,beta) condition.
Gpqr = G({'p','q','r'},:);
MATLAB Workflow for Tuning the HL-20 Autopilot