Skip to content

Commit c5b4b2e

Browse files
authored
Add script to generate Saturn IB LVDC launch azimuth polynomials
1 parent cb2a189 commit c5b4b2e

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
function GenerateSaturnIBLVDCLaunchAzimuthPolynomial
2+
3+
%Generate the constants for the Saturn IB LVDC launch azimuth polynomial
4+
%The polynomial has the form: A_Z = A00 + A01*INCL + A10*NODE + A11*INCL*NODE
5+
6+
%INPUTS
7+
LAT = 28.627151; %Launchpad latitude
8+
INCL = 51.78; %Desired orbit inclination
9+
ASC = 1; %1 = ascending node launch, 0 = descending node launch
10+
V_ORBIT = 7835; %Velocity at orbital insertion
11+
12+
13+
%CONSTANTS
14+
RAD = pi/180;
15+
DEG = 180/pi;
16+
LW_LIMIT = 3*60; %Increment in time to generate the launch azimuth array, seconds
17+
D_INCL = 1.0; %Increment in inclination to generate the launch azimuth array, degrees
18+
R_EARTH = 6.373338e6; %Radius of Earth
19+
EARTH_RATE = 7.29211514667e-5; %Rotational rate of Earth
20+
DR = 3.1e-1; %Downrange angle for ascent, value is 17.762 degrees
21+
DTOPT = 6.0*60.0 + 33;
22+
23+
%INTERNAL
24+
25+
%Convert to internal unit
26+
LAT = LAT*RAD;
27+
INCL = INCL*RAD;
28+
D_INCL = D_INCL*RAD;
29+
30+
%Generate the launch azimuths
31+
Incl_arr = [INCL INCL INCL+D_INCL INCL+D_INCL];
32+
DT_arr = [0 LW_LIMIT 0 LW_LIMIT];
33+
34+
AZL_arr = zeros(4,1);
35+
36+
for i=1:4
37+
[AZL_arr(i), Lambda_arr(i)] = OptimumLaunchAzimuth(LAT, Incl_arr(i), DT_arr(i), ASC, R_EARTH, EARTH_RATE, V_ORBIT, DR, DTOPT);
38+
endfor
39+
40+
%AZL_arr/RAD
41+
%Lambda_arr/RAD
42+
43+
%Calculate matrix
44+
for i=1:4
45+
A(i,1) = 1;
46+
A(i,2) = Incl_arr(i)*DEG;
47+
A(i,3) = Lambda_arr(i)*DEG;
48+
A(i,4) = Incl_arr(i)*Lambda_arr(i)*DEG*DEG;
49+
endfor
50+
51+
%A
52+
COEF = A^-1*(AZL_arr*DEG);
53+
54+
%Output prints
55+
printf("\nSATURN IB LVDC LAUNCH AZIMUTH POLYNOMIAL CALCULATOR 1.0\n");
56+
printf("\nLaunch latitude %.3f deg, Inclination %.3f deg\n", LAT*DEG, INCL*DEG);
57+
printf("\nSimulated launches:\n");
58+
for i=1:4
59+
printf("\nLaunch %d, inclination %.2f deg, delay of %.1f seconds from optimum\n", i, Incl_arr(i)*DEG, DT_arr(i));
60+
printf("Launch Azimuth %.4f deg, descending node angle %.4f deg\n", AZL_arr(i)*DEG, Lambda_arr(i)*DEG);
61+
endfor
62+
63+
printf("\nCoefficients:\n");
64+
for i=1:4
65+
printf("LVDC_Ax[%d] %f\n",i-1,COEF(i));
66+
endfor
67+
68+
endfunction
69+
70+
%To generate data for the LVDC launch azimuth polynomial
71+
function [AZL, DNA] = OptimumLaunchAzimuth(LAT_C, Incl, DT, ASC, R_EARTH, EARTH_RATE, v_orbit, DR, DTOPT)
72+
73+
%Calculate speed at equator
74+
v_eqrot = EARTH_RATE*R_EARTH;
75+
76+
%Inertial launch azimuth
77+
arg = cos(Incl)/cos(LAT_C);
78+
if arg > 1
79+
arg = 1;
80+
endif
81+
beta = asin(arg);
82+
if ASC == 0
83+
beta = pi - beta;
84+
endif
85+
86+
%Compensate for rotating Earth
87+
v_rotx = v_orbit*sin(beta) - v_eqrot*cos(LAT_C);
88+
v_roty = v_orbit*cos(beta);
89+
AZP = atan2(v_rotx, v_roty);
90+
if AZP < 0
91+
AZP = AZP + 2*pi;
92+
endif
93+
94+
%Now the Shuttle equations for accounting for launch off nominal time
95+
WE_DT = EARTH_RATE*DT;
96+
A = 2*asin(sin(WE_DT/2)*cos(LAT_C));
97+
if abs(A - DR) < 1e-4
98+
A = DR - 1e-4;
99+
endif
100+
101+
PHI = atan2(1 + cos(WE_DT), sin(WE_DT)*sin(LAT_C));
102+
THET = asin(sin(A)*sin(PHI-beta)/sin(DR));
103+
ALP = 2*atan2(-sin((A - DR)/2)*cos((THET - PHI + beta)/2), -sin((A + DR)/2)*sin((THET - PHI + beta)/2));
104+
DELTA_PSI_TEMP = ALP - PHI - THET - beta;
105+
%DELTA_PSI_TEMP = MIDVAL(-DELTA_PSI_LIM, DELTA_PSI_TEMP, DELTA_PSI_LIM);
106+
AZL = AZP + DELTA_PSI_TEMP;
107+
108+
%Descending node angle
109+
bias = EARTH_RATE*DTOPT;
110+
dlng = atan(sin(LAT_C)*tan(beta));
111+
if dlng < 0
112+
dlng = dlng + 2*pi;
113+
endif
114+
h = pi - dlng + bias; %lng
115+
if h < 0
116+
h = h + 2*pi;
117+
endif
118+
DNA = h - WE_DT;
119+
120+
endfunction
121+
122+
function D = MIDVAL(A, B, C)
123+
if B < A
124+
D = A;
125+
elseif B > C
126+
D = C;
127+
else
128+
D = B;
129+
endif
130+
endfunction

0 commit comments

Comments
 (0)