%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Patrick LeGresley
% Propulsion
% Last modified: May 2, 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Known problems with this code:
%
%  Need to verify the unscaled engine dimensions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Inputs:
%  T_to_uninst = total takeoff uninstalled thrust (lb)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Outputs:
%  L_eng = engine length (ft)
%  D_eng = engine diameter (ft)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [L_eng,D_eng] = propulsion(tiltwing,T_to_uninst)


if tiltwing ~= 1
   
   L_eng_unscaled = 5;
   D_eng_unscaled = 4;
   
   T_to_engine = 4*5000;             
   ESF =  T_to_uninst / T_to_engine;
   
   L_eng = ESF^0.4 * L_eng_unscaled;
   D_eng = ESF^0.5 * D_eng_unscaled;
   
   
else
   
   P_to_uninst = T_to_uninst;
   
   L_eng_unscaled = 25/12;
   D_eng_unscaled = 84/12;
   
   P_to_engine = 4*2500;             
   ESF =  P_to_uninst / P_to_engine;
   
   L_eng = ESF^0.4 * L_eng_unscaled;
   D_eng = ESF^0.5 * D_eng_unscaled;
   
end