function UR_URBAN_sim1(t_max)
% UR_URBAN_sim1 - simulate a one edge airway
% On input:
%     t_max (float): max time to simulate
% On output:
%     N/A
% Call:
%     clear all
%     rng('default');  % to get repeat result
%     UR_URBAN_sim1(100);
% Author:
%     T. Henderson
%     University of Utah
%     Summer 2019
%

% Set path to tch library
path(path,'C:\Users\user\Documents\MATLAB\tchlib');

% Set path to UAS functions
path(path,'C:\Users\user\Documents\MATLAB\URBAN-SIM\UAS');

% flight manager file name
f_FM = 'UR_flight_manager';

% USS file names
USS(1).name = 'UR_USS_111';
USS(2).name = 'UR_USS_23';

% MirrorWorld file name
f_MW = 'UR_MW';

% Set up roads (two end points, one edge)
roads = UR_gen_roads_fixed1;

% Specify launch sites
fid = fopen('LAUNCH_SITES','w');
for e = 1:2
    fprintf(fid,'%d\n',e);
end
fclose(fid);

% Specify launch sites
fid = fopen('LAND_SITES','w');
for e = 1:2
    fprintf(fid,'%d\n',e);
end
fclose(fid);

t= 0;
while t<t_max&~UR_exit_flag
    t = t + 1
    if t==10
        tch = 0;
    end
    UR_run_USS(USS,t);
    [airways,flight_plans,flights] = UR_flight_manager(roads,...
        'sim1_data.txt');
    if UR_error(flights)
        tch = 0;
    end
end
tch = 0;
