Skip to content

Commit

Permalink
Rework MTOW calculations and automate design point calculation process
Browse files Browse the repository at this point in the history
- Fix time calculation bugs in MTOW
- Rework the way battery and fuel weight is calculated in MTOW function
- Add transition mission segment type
- Fix MATLAB's JSON output with `prettyjson` function
- Update mission plotting
- Update drag and lift slope calculation
- Automate design point calculation
- Update example project file
  • Loading branch information
marioarbras committed Jul 6, 2020
1 parent f865ff8 commit a827375
Show file tree
Hide file tree
Showing 16 changed files with 781 additions and 452 deletions.
31 changes: 13 additions & 18 deletions adt.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
%
% This file is subject to the license terms in the LICENSE file included in this distribution

function data = adt(open_filename, varargin)
close all;

function data = adt(filename, varargin)
%% Load project file
data = load_project(open_filename);
data = load_project(filename);

%% Concept
data.concept = ahp(data.concept);
Expand All @@ -18,30 +16,27 @@
constants.g = 9.81; % m/s^2
constants.e = 0.85; % Oswald efficiency number.

data.aircraft.propulsion.total_efficiency = data.aircraft.propulsion.prop_efficiency * data.aircraft.propulsion.gear_efficiency * data.aircraft.propulsion.em_efficiency * data.aircraft.propulsion.esc_efficiency * data.aircraft.propulsion.dist_efficiency;
data.mission.mf_prop = estimate_mf_prop(1.2, 0.04, 1.5, 0.3, 0.1, 0.5, data.aircraft.propulsion.config);
data.mission.mf_subs = estimate_mf_subs(data.mission.mf_prop, data.mission.mf_struct);

% Take-off mass estimation
[data.mission, data.aircraft] = mtow(data.mission, data.aircraft, constants);
% Build mission profile
data.mission = build_mission(data.mission);

%% Plot mission profile
plot_mission(data.mission);

% Take-off mass estimation
[data.mission, data.aircraft] = mtow(data.mission, data.aircraft, constants);

%% Design point calculation
data.aircraft = design_point(data.mission, data.aircraft, constants);

%% Engine selection
data.mission.mf_prop = data.aircraft.propulsion.mass / data.aircraft.mass_to;

%% Lifting surface design
data.aircraft = lifting_surface(data.aircraft, data.mission.segments{3});
% Recalculate take-off mass based on updated values from design point
% [data.mission, data.aircraft] = mtow(data.mission, data.aircraft, constants);
% data.aircraft = design_point(data.mission, data.aircraft, constants);

%% Fuselage design
data.aircraft = fuselage(data.aircraft, data.mission.segments{3});
%% Lift curve slope
data.aircraft = lift_slope(data.aircraft, data.mission);

%% Drag buildup
data.aircraft = drag_buildup(data.aircraft);
data.aircraft = drag_buildup(data.aircraft, data.mission);

%% Save new project file
if ~isempty(varargin)
Expand Down
49 changes: 49 additions & 0 deletions build_mission.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
% Aircraft design tool
%
% Mario Bras ([email protected]) and Ricardo Marques ([email protected]) 2019
%
% This file is subject to the license terms in the LICENSE file included in this distribution

function mission = build_mission(mission)

% Iterate over mission segments
for i = 1 : length(mission.segments)
[mission.segments{i}.temperature, mission.segments{i}.speed_sound, mission.segments{i}.pressure, mission.segments{i}.density] = atmosisa(mission.segments{i}.altitude);

if ~isfield(mission.segments{i}, 'velocity')
mission.segments{i}.velocity = 0;
end

if strcmp(mission.segments{i}.type, 'taxi') % Taxi segment
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'hover') % Hover segment
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'transition') % Transition segment
mission.segments{i}.range = mean(mission.segments{i}.velocity) * mission.segments{i}.time;
elseif strcmp(mission.segments{i}.type, 'climb') % Climb segment
mission.segments{i}.time = (mission.segments{i}.altitude(2) - mission.segments{i}.altitude(1)) / mission.segments{i}.velocity / sind(mission.segments{i}.angle);
mission.segments{i}.range = mission.segments{i}.velocity * mission.segments{i}.time * cosd(mission.segments{i}.angle);
elseif strcmp(mission.segments{i}.type, 'vertical_climb') % Vertical climb segment
mission.segments{i}.time = (mission.segments{i}.altitude(2) - mission.segments{i}.altitude(1)) / mission.segments{i}.velocity;
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'acceleration') % Acceleration segment
mission.segments{i}.range = mission.segments{i}.velocity * mission.segments{i}.time;
elseif strcmp(mission.segments{i}.type, 'cruise') % Cruise segment
mission.segments{i}.time = mission.segments{i}.range / mission.segments{i}.velocity;
elseif strcmp(mission.segments{i}.type, 'hold') % Hold segment
mission.segments{i}.range = mission.segments{i}.velocity * mission.segments{i}.time;
% elseif strcmp(mission.segments{i}.type, 'combat') % Combat segment
elseif strcmp(mission.segments{i}.type, 'descent') % Descent segment
mission.segments{i}.time = abs(mission.segments{i}.altitude(2) - mission.segments{i}.altitude(1)) / abs(mission.segments{i}.velocity) / abs(sind(mission.segments{i}.angle));
mission.segments{i}.range = abs(mission.segments{i}.velocity) * mission.segments{i}.time * abs(cosd(mission.segments{i}.angle));
elseif strcmp(mission.segments{i}.type, 'vertical_descent') % Vertical descent segment
mission.segments{i}.time = abs(mission.segments{i}.altitude(2) - mission.segments{i}.altitude(1)) / abs(mission.segments{i}.velocity);
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'landing') % Landing segment
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'drop') % Drop segment
mission.segments{i}.range = 0;
elseif strcmp(mission.segments{i}.type, 'load') % Load segment
mission.segments{i}.range = 0;
end
end
Loading

0 comments on commit a827375

Please sign in to comment.