% Burner
% The burner simply converts and ideally transfers chemical energy from the
% fuel to the gas
function [Gas_out] = Burner(Gas_in, T_max)

global G_fuel                       % Mass flow of fuel is a global variable (kg/s)
cp_hot = 1244;                      % Specific Heat at Constant Pressure Estimated from (R. Sonntag et al, Fundamentals of Thermodynamics)


T1 = Gas_in(1);                     % Temperature In (Kelvin)
P1 = Gas_in(2);                     % Pressure In (Pascal)
G_air = Gas_in(3);                  % Air mass flow (kg/s)

% Burner Design Parameters
PR = 0.9;                           % Pressure Ratio
c = 4.3*10^7;                       % Specific Heat of Combustion J/kg

% Burner Equations (Ignore increase in mass flow from fuel)
P2= PR*P1;                          % Calculate Exit Pressure (Pascal)
T2 = T_max;                         % Calculate Exit Temperature (Kelvin)
G_fuel =(T2-T1)*cp_hot*G_air/c;     % Calculate Mass Flow of Fuel (kg/s) (Anderson, Fundamentals of Aerodynamics)       
Gas_out = [T2, P2, G_air];          % Store all the values in a vector for output 

end

