% Brent Kam-Young
% AAE 450 - Professor Longuski
% Flight Control Value Generator
% February 13, 2010
clear all
clc
% Determine Current Altitude
abc = 0;
while abc == 0
alt = (1/1000)*input('What is current altitude (km) under 3 km\n'); %meters
if alt < 0
disp('Negative altitude not possible, try again')
elseif alt > 3
disp('Airship not within computable range')
else
abc = 1;
end
end
% Determine Current Airship Velocity
abc = 0;
while abc == 0
airship_vel = input('What is current airship velocity (m/s)\n');
if airship_vel < 0
disp('Negative altitude not possible, try again')
elseif airship_vel > 8
disp('Airship not within computable range')
else
abc = 1;
end
end
% Determine Wind Magnitude/Direction
abc = 0;
while abc == 0
wind_input = input('Is the wind random? (If yes, enter 1, else enter 0)\n');
if wind_input == 1
wind_mag = 4*rand(1);
wind_dir = 360*rand(1);
abc = 1;
elseif wind_input == 0
wind_mag = input('Enter wind magnitude (m/s)\n');
wind_dir = (pi/180)*input('Enter wind direction (degrees), where 180 is a favorable tail-wind\n'); %converts to radians
abc = 1;
end
end
% Determine other important constants
rho_ref = 5.4; %(kg/m3)
h_ref = 40*10^3; %km
rho = rho_ref*exp(-alt/h_ref); % density
stabilizer_torque_arm = 1.5; %meter
stabilizer_ref_area = 2 * 0.425; %m2
stabilizer_max_deflection = 35; % degrees
airship_length = 20; %meter
airship_radius = 3; %meter
airship_cross_area = pi*airship_radius^2; %m2
airship_tail_area = 4 * 0.425; %m2
% Determine Winds Effect on Aifship
wind_moment = stabilizer_torque_arm*sin(wind_dir)*rho*airship_tail_area*wind_mag^2;
wind_force_x = -cos(wind_dir)*rho*airship_cross_area*wind_mag^2;
wind_force_y = -sin(wind_dir)*rho*airship_cross_area*wind_mag^2;
% Enter Navigation Data
nav_beta = (pi/180)*input('Enter Navigation POI direction (degrees)\n'); %radians
nav_alt = (1/1000)*input('Enter Navigation POI altitude (km)\n'); %meters
nav_dist = (1/1000)*input('Enter Navigation POI distance (km)\n'); %meters
% Determine Required Stabilizer Deflection
if nav_beta > wind_dir
if abs(wind_moment/(rho*airship_tail_area*stabilizer_torque_arm*airship_vel^2)) > 1
stabilizer_delta_yaw = stabilizer_max_deflection;
else
stabilizer_delta_yaw = asind(-wind_moment/(rho*airship_tail_area*stabilizer_torque_arm*airship_vel^2)); %degrees
end
else
wind_moment = stabilizer_torque_arm*sin(wind_dir-nav_beta)*rho*airship_tail_area*wind_mag^2;
if abs(wind_moment/(rho*airship_tail_area*stabilizer_torque_arm*airship_vel^2)) > 1
stabilizer_delta_yaw = stabilizer_max_deflection;
else
stabilizer_delta_yaw = asind(-wind_moment/(rho*airship_tail_area*stabilizer_torque_arm*airship_vel^2)); %degrees
end
end
fprintf('Hold deflection of rudders at %f2 until Navigation Yaw achieved\n',stabilizer_delta_yaw)
nav_alt_difference = nav_alt - alt;
required_pitch = asind((nav_alt_difference)/sqrt(nav_alt_difference^2 + nav_dist^2)); %degrees
wind_moment = stabilizer_torque_arm*sin(required_pitch)*rho*airship_tail_area*wind_mag^2;
if abs(required_pitch) > stabilizer_max_deflection
stabilizer_delta_pitch = stabilizer_max_deflection;
else
stabilizer_delta_pitch = asind(-wind_moment/(rho*airship_tail_area*stabilizer_torque_arm*airship_vel^2)); %degrees
end
fprintf('Hold deflection of elevators at %f2 until Navigation Altitude achieved\n',stabilizer_delta_pitch)