forked from Airspace-Encounter-Models/em-model-manned-bayes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRUN_uncor.m
70 lines (55 loc) · 2.95 KB
/
RUN_uncor.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% Copyright 2008 - 2021, MIT Lincoln Laboratory
% SPDX-License-Identifier: BSD-2-Clause
%% Instruction
% This script demonstrates how to use the UncorEncounterModel class to
% draw samples from an uncorrelated encounter model and
% generate independent aircraft tracks by rejection sampling the model.
% The default model parameter file is for a conventional aircraft. If a
% different model is used, the start distribution needs to be updated.
%% Startup script
file_startup = [getenv('AEM_DIR_BAYES') filesep 'startup_bayes.m'];
run(file_startup);
%% Inputs
% ASCII model parameter file
parameters_filename = [getenv('AEM_DIR_BAYES') filesep 'model' filesep 'uncor_1200only_fwse_v1p2.txt'];
% Number of sample / tracks
n_samples = 1;
% Duration of each sample / track
sample_time = 210;
% Random seed
init_seed = 1;
%% Instantiate object
mdl = UncorEncounterModel('parameters_filename', parameters_filename);
%% Set start distribution
% Preallocate new start distribution local to workspace
% The size of the variable corresponds to the number of
% variables in the initial network
start = cell(mdl.n_initial, 1);
% Force the model to sample from specific variable bins
% These values are for the uncorrelated conventional aircraft models. If
% using an unconventional model (i.e. gliders) or the due regard model,
% update or comment out accordingly. Also comment out if you don't want to
% define a start distribution.
start{1} = 1; % Geographic domain - CONUS (G = 1)
start{2} = 4; % Airspace class - Other airspace (A = 4)
start{3} = 2; % Altitude layer - [500, 1200) feet AGL (L = 2)
% Update the object with the start distribution
mdl.start = start;
%% Demonstrate how to generate samples
[out_inits, out_events, out_samples, out_EME] = mdl.sample(n_samples, sample_time, 'seed', init_seed);
%% Demonstrate how to generate tracks
% Local relative Cartesian coordinate system
out_results_NEU = mdl.track(n_samples, sample_time, 'initialSeed', init_seed, 'coordSys', 'NEU');
% Geodetic coordinate system
% lat0_deg = 44.25889; lon0_deg = -71.31887; % Lake of the Clouds, White Mountains, NH
% lat0_deg = 40.01031; lon0_deg = -105.22097; % Flatirons Golf Course, Boulder, CO
% lat0_deg = 46.96983; lon0_deg = -101.54661; % Bison Wind Project, ND
lat0_deg = 42.29959; lon0_deg = -71.22220; % Exit 35C on I95, Massachusetts
% Geodetic track maintaining at least 2000 feet laterally from a point obstacle
out_results_geo2000 = mdl.track(n_samples, sample_time, 'initialSeed', init_seed, 'coordSys', 'geodetic', ...
'lat0_deg', lat0_deg, 'lon0_deg', lon0_deg, ...
'dofMaxRange_ft', 2000, 'isPlot', true);
% Geodetic track maintaining at least 500 feet laterally from a point obstacle
out_results_geo500 = mdl.track(n_samples, sample_time, 'initialSeed', init_seed, 'coordSys', 'geodetic', ...
'lat0_deg', lat0_deg, 'lon0_deg', lon0_deg, ...
'dofMaxRange_ft', 500, 'isPlot', true);