summaryrefslogtreecommitdiffstats
path: root/uav_uncertainty.m
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-14 17:54:05 +0200
committerNao Pross <np@0hm.ch>2024-05-14 17:54:32 +0200
commit956a5bab88ac0a505b16d131e600c6f1a1afdbac (patch)
tree482e613fa65bd7a2f188b6f0871c74ca90f7242b /uav_uncertainty.m
parentImplement DK iteration (diff)
downloaduav-956a5bab88ac0a505b16d131e600c6f1a1afdbac.tar.gz
uav-956a5bab88ac0a505b16d131e600c6f1a1afdbac.zip
Fix DK iteration scales, add realistic values
also separate performance requirements from hinf and musyn
Diffstat (limited to 'uav_uncertainty.m')
-rw-r--r--uav_uncertainty.m38
1 files changed, 34 insertions, 4 deletions
diff --git a/uav_uncertainty.m b/uav_uncertainty.m
index e1ddf76..6f28d8d 100644
--- a/uav_uncertainty.m
+++ b/uav_uncertainty.m
@@ -13,16 +13,46 @@
% UNCERT Struct of uncertainty transfer functions
-function [uncert] = uav_performance(params, plot)
+function [uncert] = uav_performance(params, do_plots)
-W_malpha = tf(1,1);
-W_momega = tf(1,1);
-W_mState = tf(1,1);
+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);
+
+% 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);
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('Stability (Uncertainty) Requirement')
+end
+
end
% vim: ts=2 sw=2 et: