-
Notifications
You must be signed in to change notification settings - Fork 2
/
orbit_lydane_export.sce
168 lines (140 loc) · 5.73 KB
/
orbit_lydane_export.sce
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
//=============================================================================
//
// MISSION ANALYSIS : Project TOLOSAT
//
//=============================================================================
xdel(winsid())
clear
CL_init()
// =====================================================
// IMPORT RESULTS FROM STELA PROPAGATION
// =====================================================
stela_cjd=csvRead("stela_datevector.csv")';
stela_eclipses=csvRead("stela_eclipses.csv")';
stela_mean_kep=csvRead("stela_mean_kep.csv")';
// =====================================================
// SELECT LYDANE PROPAGATION EPOCHS
// =====================================================
stela_selected_days=[150,350,720,1070,1450];
stela_timestep=stela_cjd(2)-stela_cjd(1);
lydane_epochs_0=stela_cjd(1)+stela_selected_days;
lydane_duration=5;
lydane_timestep=30/86400
// =====================================================
// ANALYTICAL PROPAGATION WITH LYDANE
// =====================================================
lydane_cjd=%nan*zeros(length(lydane_epochs_0),length((0:lydane_timestep:lydane_duration)));
sat_x_eci=lydane_cjd;
sat_y_eci=lydane_cjd;
sat_z_eci=lydane_cjd;
sun_x_eci=lydane_cjd;
sun_y_eci=lydane_cjd;
sun_z_eci=lydane_cjd;
lydane_sma=lydane_cjd;
lydane_ecc=lydane_cjd;
lydane_inc=lydane_cjd;
lydane_pom=lydane_cjd;
lydane_RAAN=lydane_cjd;
lydane_M=lydane_cjd;
for ii=1:length(lydane_epochs_0)
lydane_epoch_0=stela_cjd(stela_cjd>=lydane_epochs_0(ii) & stela_cjd<(lydane_epochs_0(ii)+stela_timestep))
lydane_kep_ini=stela_mean_kep(:,stela_cjd==lydane_epoch_0)
lydane_cjd(ii,:)=lydane_epoch_0+(0:lydane_timestep:lydane_duration)
lydane_kep_results = CL_ex_propagate("lydlp","kep",lydane_epoch_0,lydane_kep_ini,lydane_cjd(ii,:),'m');
[sat_pos_tmp,sat_vel_tmp] = CL_oe_kep2car(lydane_kep_results);
sat_x_eci(ii,:)=sat_pos_tmp(1,:);
sat_y_eci(ii,:)=sat_pos_tmp(2,:);
sat_z_eci(ii,:)=sat_pos_tmp(3,:);
sun_pos_tmp = CL_eph_sun(lydane_cjd(ii,:))
sun_x_eci(ii,:)=sun_pos_tmp(1,:);
sun_y_eci(ii,:)=sun_pos_tmp(2,:);
sun_z_eci(ii,:)=sun_pos_tmp(3,:);
lydane_sma(ii,:) = lydane_kep_results(1,:); // Semi-major axis [m]
lydane_ecc(ii,:) = lydane_kep_results(2,:); // Eccentricity [-]
lydane_inc(ii,:) = lydane_kep_results(3,:); // Inclination [rad]
lydane_pom(ii,:) = lydane_kep_results(4,:); // Argument of perigee [rad]
lydane_RAAN(ii,:) = lydane_kep_results(5,:); // Right ascension of the ascending node (RAAN) [rad]
lydane_M(ii,:) = lydane_kep_results(6,:); // Mean anomaly [rad]
end
// Propagate the orbit
// The lydane model is the most complete analytical model of celestlab
// Here, mean parameters are chosen over osculating parameters as they have a better physical significance
// https://space.stackexchange.com/questions/14731/nuances-of-the-terms-mean-osculating-keplerian-orbital-elements
//// Compute the true and eccentric anomalies from M and ecc
//E_ana = CL_kp_M2E(ecc_ana,M_ana);
//v_ana = CL_kp_M2v(ecc_ana,M_ana);
//
//// Compute the MLTAN fron the RAAN and date
//mltan_ana = CL_op_locTime(cjd, "ra", RAAN_ana, "mlh");
//
//// Compute the evolution of the orbital period
//mm = CL_kp_params('mm',sma_ana); // Mean motion [rad]
//per = CL_kp_params('per',sma_ana); // Orbital period [s]
//// /!\ Mean parameter are needed to accurately compute the orbital period.
// =====================================================
// PLOTS OF THE ORBIT EVOLUTION
// =====================================================
Color=["blue","red","green","orange","purple"];
legend_name=string(stela_selected_days);
scf(1);
subplot(231)
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_sma(ii,:)- %CL_eqRad,"Color",Color(ii))
end
title('Altitude')
xlabel('Elapsed days since launch')
ylabel('Altitude (m)')
legend(legend_name)
CL_g_stdaxes();
subplot(232)
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_inc(ii,:)*%CL_rad2deg,"Color",Color(ii))
end
legend(legend_name)
title('Inclination')
xlabel('Elapsed days since launch')
ylabel('Inclination (deg)')
CL_g_stdaxes();
subplot(233)
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_ecc(ii,:),"Color",Color(ii))
end
legend(legend_name)
title('Eccentricity')
xlabel('Elapsed days since launch')
ylabel('Eccentricity')
CL_g_stdaxes();
subplot(234);
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_pom(ii,:)*%CL_rad2deg,"Color",Color(ii))
end
legend(legend_name)
title('Argument of perigee')
xlabel('Elapsed days since launch')
ylabel('Argument of perigee (deg)')
CL_g_stdaxes();
subplot(235);
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_RAAN(ii,:)*%CL_rad2deg,"Color",Color(ii))
end
legend(legend_name)
title('RAAN')
xlabel('Elapsed days since launch')
ylabel('RAAN (deg)')
CL_g_stdaxes();
subplot(236);
for ii=1:length(lydane_epochs_0)
plot(lydane_cjd(ii,:)-lydane_cjd(ii,1),lydane_M(ii,:)*%CL_rad2deg,"Color",Color(ii))
end
legend(legend_name)
title('Mean Anomaly')
ylabel('Mean Anomaly (deg)')
xlabel('Elapsed days since launch')
CL_g_stdaxes();
scf(1).figure_size=[2000,1000];
deletefile('orbit_evolution_lydane.png');
xs2png(1,'orbit_evolution_lydane.png');
for ii=1:length(lydane_epochs_0)
csvWrite([(lydane_cjd(ii,:)'-lydane_cjd(ii,1))*86400,sun_x_eci(ii,:)',sun_y_eci(ii,:)',sun_z_eci(ii,:)'],strcat(['sun_eci_',string(stela_selected_days(ii)),'.csv']))
csvWrite([(lydane_cjd(ii,:)'-lydane_cjd(ii,1))*86400,sat_x_eci(ii,:)',sat_y_eci(ii,:)',sat_z_eci(ii,:)'],strcat(['sat_eci_',string(stela_selected_days(ii)),'.csv']))
end