1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
% Generate transfer functions for loop shaping stability (uncertainty)
% requirements from parameters specified in uav_params.m
%
% Copyright (C) 2024, Naoki Sean Pross, ETH Zürich
% This work is distributed under a permissive license, see LICENSE.txt
%
% Arguments:
% PARAMS Struct of design parameters and constants generated by uav_params
% PLOT When set to 'true' it plots the inverse magnitude of the
% performance transfer function
%
% Return value:
% UNCERT Struct of uncertainty transfer functions
function [uncert] = uav_performance(params, do_plots)
s = tf('s');
% relative errors
eps_T = params.aerodynamics.ThrustOmegaPropUncertainty;
eps_r = params.mechanical.GyroscopicInertiaZUncertainty;
eps_S = params.aerodynamics.FlapAreaUncertainty;
eps_l = params.aerodynamics.LiftCoefficientUncertainty;
eps_d = params.aerodynamics.DragCoefficientsUncertainties(1);
% eps_0 = params.aerodynamics.DragCoefficients(2);
eps_omega = max(.5 * eps_T, eps_r);
eps_alpha = max(eps_l + eps_S + 2 * eps_omega, eps_S + eps_d + eps_omega);
% TODO: set proper constraints
% band pass parameters for W_malpha
% wh = 20; % high freq
% wl = .1; % low freq
% W_malpha = eps_alpha * (s / wl) / ((s / wh + 1) * (s / wl + 1));
% W_momega = eps_omega * 10 / (s + 10);
% W_mState = .01 * 10 / (s + 10);
W_malpha = eps_alpha * tf(1);
W_momega = tf(0);
W_mState = .01 * tf(1);
uncert = struct(...
'FlapAngle', W_malpha * eye(4), ...
'Thrust', W_momega, ...
'StateLinApprox', W_mState * eye(12));
if do_plots
% Bode plots of performance requirements
figure; hold on;
bodemag(W_malpha);
bodemag(W_momega);
bodemag(W_mState);
grid on;
legend('$W_{m,\alpha}$', '$W_{m,\omega}$', '$W_{m,\mathbf{P}}$', ...
'interpreter', 'latex')
title('\bfseries Stability Requirement (only for $\mu$-Synthesis)', ...
'interpreter', 'latex')
end
end
% vim: ts=2 sw=2 et:
|