% Simple Matlab code to estimate the runway exit location
% using the three point method

% Description: program assumes three segments in the landing roll
% trajectory of the aircraft to estimate the aproximate location of a
% runway exit for a give aircraft

% Aircraft are assumed to fly and cross the ruway threshold at an approach
% speed (Vapp), touchdown at (Stouchdown) distance from the threshold and decelerate at 
% (a_brake) deceleration rate. The exit speed needs to be consistent
% with the runwaye exit geometry selected. See notes # 9 for typical values
% recorded in the field.

% A. Trani (March 1, 2009)

% Input parameters

Vapp                  = 120;                    % approach speed (knots)
tfr1                     = 2;                        % free roll time (seconds)
Stouchdown       = 370;                     % touchdown distance (meters)
a_brake              = -1.3;                    % average braking rate (m/s-s)
a_fr1                  = 0.3;                      % average free roll or transition deceleration (m/s-s)
Vexit                  = 15;                       % exit speed (knots)

Vapp = Vapp / 1.94;                        % convert to meters/second
Vexit = Vexit / 1.94;                        % in m/s

% Flare segment computations

Vtouchdown       = 0.95 * Vapp;                                                  % touchdown speed (m/s)
tflare                  = 2 * Stouchdown / (Vapp - Vtouchdown);      % time in flare maneuver (seconds)
S1                      = Stouchdown;                                                   % distance in flare segment (meters)

% Transition segment computations

Vo_transition    = Vtouchdown;
Vf_transition    = Vo_transition + a_fr1 * tfr1;                     % final speed in transition segment (m/s)

S2                    = (Vf_transition + Vo_transition) / 2 * tfr1;    % distance in transition segment (meters)

% Braking segment computations

t_brake            = (Vexit - Vf_transition)/a_brake;                   % time in braking segment (seconds)
S3                    = 1/2 * (Vf_transition - Vexit) * t_brake;        % distance in braking phase (meters)


% Add all segments to calculate total distance to a runway exit with exit
% speed Vexit

stotal = S1 + S2 + S3;

% Display results in the Command window

disp(' ')
disp(['Flare distance =   ', num2str(S1), '  meters'])
disp(['Transition distance =   ', num2str(S2), '  meters'])
disp(['Braking distance =   ', num2str(S3), '  meters'])
disp(['Total Distance to Runway Exit =   ', num2str(stotal), '  meters'])
disp(' ')



