-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathastra_with_custom_eph_mice.m
More file actions
83 lines (59 loc) · 3.04 KB
/
Copy pathastra_with_custom_eph_mice.m
File metadata and controls
83 lines (59 loc) · 3.04 KB
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
clearDeleteAdd; % --> !!! ONLY CALL IT ONCE FOR SPEED
%% --> input section
% --> clear INPUT and define new ones
try clear INPUT; catch; end; clc;
% --> sequence to be optimized
INPUT.idcentral = 1; % --> central body (Sun in this case)
seq = [ 3 2 3 4 3 5 ]; res = [ ];
%%%%%%%%%% multi-rev. options %%%%%%%%%%
maxrev = 0; % --> max. number of revolutions (round number)
chosenRevs = differentRuns_v2(seq, maxrev); % --> generate successive runs
[INPUT.chosenRevs, INPUT.res] = processResonances(chosenRevs, res); % --> process the resonances options
[INPUT.chosenRevs] = maxRevOuterPlanets(seq, INPUT.chosenRevs, INPUT.idcentral); % --> only zero revs. on outer planets
%%%%%%%%%% multi-rev. options %%%%%%%%%%
%%%%%%%%%% set departing options %%%%%%%%%%
t0 = date2mjd2000([2023 1 1 0 0 0]); % --> initial date range (MJD2000)
tf = t0 + 1*365.25; % --> final date range (MJD2000)
dt = 3; % --> step size (days)
INPUT.depOpts = [t0 tf dt];
%%%%%%%%%% set departing options %%%%%%%%%%
%%%%%%%%%% set options %%%%%%%%%%
INPUT.opt = 2; % --> (1) is for SODP, (2) is for MODP, (3) is for DATES, (4) is for YEARS - MODP
INPUT.vInfOpts = [0 5]; % --> min/max departing infinity velocities (km/s)
INPUT.dsmOpts = [2 Inf]; % --> max defect DSM, and total DSMs (km/s)
INPUT.plot = [1 1]; % --> plot(1) for Pareto front, plot(2) for best traj. DV
INPUT.parallel = true; % --> put true for parallel, false otherwise
INPUT.tstep = dt; % --> step size for Time of flight
%%%%%%%%%% set options %%%%%%%%%%
%%
% --> load custom ephemerides
MICE_path = './MICE_TOOLBOX' ;
addpath(genpath(MICE_path)); % --> always include this
cspice_furnsh([MICE_path '/data.mk']);
INPUT.customEphemerides = @EphSS_from_mice;
%% --> optimize using ASTRA
% --> launch ASTRA optimization
OUTPUT = ASTRA_DP(seq, INPUT);
%%
% --> process the OUTPUT
processed_OUTPUT = postProcessOutputASTRA( OUTPUT );
% --> process the output for better user experience
paretoFront = process_paretoFront_structure( INPUT, processed_OUTPUT );
%% --> extract desired path and plot
close all; clc;
% --> extract path from Pareto front
[path, revs, res] = pathfromPF(OUTPUT, 1, 1, [], INPUT.customEphemerides);
% --> plot the Pareto front
figPareto = plotPareto(OUTPUT(1).ovPF);
% --> plot the path
[figECI, STRUC, figSYN, figRSC, figVSC] = plotPath(path, INPUT.idcentral, INPUT.customEphemerides);
% --> save the output
generateOutputTXT(path, INPUT.idcentral, INPUT.customEphemerides, './results', 'customEphRes_EVEMEJ');
%% --> futher refine around the optimal DV-solution
INPUT.t0days = 10; % --> days around current solution departing epoch
INPUT.tofdays = 15; % --> days around current solution TOFs
INPUT.dt = 0.5; % --> step size (days)
INPUT.revs = revs;
INPUT.res = res;
% --> further refine using ASTRA
OUTPUTref = refineUsingASTRApath(path, INPUT);