File size: 10,163 Bytes
5ab75a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
function out = EventRate(paramsInfo)
%%
% EventRate - Estimate the rate conjunctions exceeding a threshold Pc value 
% occur for a model mission occupying an orbit/environment similar to that
% of a primary satellite with data archived in the CARA database.
%
% Syntax: out = EventRate(paramsInfo);
%
% =========================================================================
%
% Copyright (c) 2025-2026 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================
%
% Description: 
%
% Estimate the rate conjunctions exceeding a threshold Pc value occur for
% a model mission occupying an orbit/environment similar to that of a
% primary satellite or satellites with data archived in the CARA database.
%
% The analysis uses the method for semi-empirical conjunction risk analysis
% as described in
%
%  Doyle Hall (2019) "Determining Appropriate Risk Remediation Thresholds
%  from Empirical Conjunction Data using Survival Probability Methods" 
%  AAS 19-631.
%
% Specifically, the "last-update" Pc value for an event must exceed a
% user-specified Pc threshold to contribute to the estimated event rate.
% For a model mission that conducts remediation mitigation maneuvers
% (RMMs), last-update values are those estimated just before the
% mission's RMM "commit" time (but also after the mission's RMM "consider" 
% time).  The last-update Pc then can be regarded as the "perceived"
% collision risk of the event. The algorithm uses the archived record of
% last-update Pc values to estimate event rates, as well as the perceived
% mission-cumulative collision risk. 
%
% =========================================================================
%
% Input:
%   
%   paramsInfo - Input parameter structure containing information regarding
%                the input conjunction data, analysis configuration and the 
%                prospective mission to be analyzed. 
% 
%                See EventRate_default_params.m and 
%                EventRate_ConjDist_default_params.m for full 
%                documentation.
%                
%                Required fields:
%                   OCMDBFile OR PcTableFile - Name of an OCMDB data file 
%                   for processing. If OCMDBFile is used, EventRate will 
%                   precompute reference Pc values and save them to an
%                   augmented PcTableFile. This file may be provided as a
%                   PcTableFile parameter instead to skip preprocessing on
%                   future runs.
%
%                   priset - A set of one or more mission surrogate 
%                   satellite NORAD IDs. These IDs must be present in the 
%                   OCMDBFile or PcTableFile data
%
%                All other fields will be populated with default values if
%                not set
%
% =========================================================================
%
% Output:
%
%   out        -   output structure
%
%       CumulativePcNoRMMs   - [1x3] array of the [median, lower bound, 
%                              upper bound] of the 95% confidence interval 
%                              of estimated cumulative Pc for the 
%                              prospective mission duration without RMMs 
%                              considered 
%
%       CumulativePcWithRMMs - [1x3] array of the [median, lower bound, 
%                              upper bound] of the 95% confidence interval 
%                              of estimated cumulative Pc for the 
%                              prospective mission duration with RMMs
%                              considered
%   
%       MissionEventRate     - [1x3] array of the [median, lower bound,
%                              upper bound] of the 95% confidencer interval
%                              of estimated mission red event rate for the
%                              prospective mission red threshold Pc.
%
%       ConjDist             - Structure containing various intermediate
%                              values calculated within EventRate_ConjDist
%
% =========================================================================
%
% References:
%
%   Doyle Hall (2019) "Determining Appropriate Risk Remediation Thresholds
%   from Empirical Conjunction Data using Survival Probability Methods" 
%   AAS 19-631.
%
% =========================================================================
%
% Dependencies:
%
%   ProcessPcTable.m
%   EventRate_ConjDist.m
%   EventRate_default_params.m
%
% =========================================================================
%
% Subfunctions:
%
%   None
%
% =========================================================================
%
% Disclaimer:
%
%    No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY
%    WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY,
%    INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE
%    WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
%    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM
%    INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
%    FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO
%    THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER,
%    CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT
%    OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY
%    OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE.
%    FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES
%    REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE,
%    AND DISTRIBUTES IT "AS IS."
%
%    Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS
%    AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND
%    SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT.  IF RECIPIENT'S USE OF
%    THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES,
%    EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM
%    PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT
%    SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED
%    STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
%    PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT'S SOLE
%    REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL
%    TERMINATION OF THIS AGREEMENT.
%
% =========================================================================
%
% Initial version: Apr 2022;  Latest update: Feb 2026
%
% ----------------- BEGIN CODE -----------------
%% Initializations
persistent pathsAdded
if isempty(pathsAdded)
    [p,~,~] = fileparts(mfilename('fullpath'));
    s = what(fullfile(p,'/params')); addpath(s.path);
    s = what(fullfile(p,'/src')); addpath(s.path);
    s = what(fullfile(p,'/src/matlab_lib')); addpath(s.path);
    s = what(fullfile(p,'/src/ConjDist')); addpath(s.path);
    s = what(fullfile(p,'../ProbabilityOfCollision')); addpath(s.path);
    s = what(fullfile(p,'../Utils/AugmentedMath')); addpath(s.path);
    s = what(fullfile(p,'../Utils/CovarianceTransformations')); addpath(s.path);
    s = what(fullfile(p,'../Utils/General')); addpath(s.path);
    s = what(fullfile(p,'../Utils/Plotting/Utils')); addpath(s.path);
    s = what(fullfile(p,'../Utils/TimeTransformations')); addpath(s.path);

    pathsAdded = true;
end

% Initialize the program execution parameters
if nargin < 1
    params = [];
else
    params = initialize_params(paramsInfo);
end

%% Augment params structure with the default EventRate parameters
params = EventRate_default_params(params);

%% Automatically combine and partitioned files, as needed
CombinePartitionedFiles(params.SplitFilesDir, params.DataDir);

%% Check for OCMDB file and associated Pc table file
if params.PcTable_mode == 0
    
    % Check for the existence of the OCMDB file
    if ~exist(params.OCMDBfile,'file')
        [~,f,e] = fileparts(params.OCMDBfile);
        warning(['Could not find OCMDB data file: ' [f e]]);
        out = [];
        return;
    end
    
    % Set PcTable to null to indicate Pc table mode is not being used
    params.PcTable = [];
    
else
    
    % Do the processesing required to use Pc table mode
    params = ProcessPcTable(params);
    
    % Ensure Pc table and DB exist
    if isempty(params.PcTable) || isempty(params.DB)
        warning('Invalid Pc table or DB array');
        out = [];
        return;
    end
    
    % Return now if only building the PcTable, and not doing any other
    % EventRate processing
    if params.PcTable_mode == 3
        out = [];
        return;
    end

    % Return with warning if using exclude_noncatastrophic parameter, which
    % is incompatible with PcTable mode
    if params.exclude_noncatastrophic
        warning('Pc table mode incompatible with exclude_noncatastrophic parameter');
        out = [];
        return;
    end
    
end

%% Perform the EventRate processing
% (using the EventRate version of the ConjDist function)
out = EventRate_ConjDist(params);

return
end
% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
% ----------------- CHANGE HISTORY ------------------
% Developer |     Date    | Description
% ---------------------------------------------------
% D. Hall   | 2022-Apr-11 | Initial version.
% L. Baars  | 2026-Feb-24 | Added call to combine partitioned files.
% =========================================================================
%
% Copyright (c) 2025-2026 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================