-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mass_Estimates_Zephyr_PythonLinked.m
executable file
·146 lines (125 loc) · 7.19 KB
/
Mass_Estimates_Zephyr_PythonLinked.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
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
clc
clear
%==========================================================================
% This code develops the initial Mass Estimations
%
% Developed by: Ape Lincoln
%
% Editors notes:
% Change only the values in the Inputs category
% First values in each array is for Zephyr
% Second Value in each array is for Latona
%
%==========================================================================
% known variables
g0 = 9.80665; % m/s^2
m_payload = [30 95]; % Payload for mission 1 and 2 respectively (kg)
%==========================================================================
% input
One_dv_params = readtable('LVMasses\OnedVParameters.csv'); % load Mission 1 dv requirements csv into table
Two_dv_params = readtable('LVMasses\TwodVParameters.csv'); % load Mission 2 dv requirements csv into table
% V_loss = [1759.55048 1759.55048]; % Velocity from losses for Zephyr and Latona (m/s)
% V_plane = 1304.93618; % Mission 2 plane change DV
% V_Orbital = [85.34026 98.92758+V_plane]; % Other DV losses for LV
% V_Recover = 0.00000; % Recovery DV
% V_ideal = [7687.89945 7829.83702]; % Ideal velocity of mission 1 and 2 Respectively(m/s)
V_loss = [One_dv_params{1,4}+One_dv_params{1,5}, Two_dv_params{1,4}+Two_dv_params{1,5}]; % Velocity from losses for Minerva and Latona (m/s)
V_plane = Two_dv_params{1,3};
V_Orbital = [One_dv_params{1,6}, Two_dv_params{1,6}+V_plane]; % Other DV losses for LV
V_Recover = Two_dv_params{1,7}; % Recovery DV
V_ideal = [One_dv_params{1,1}, Two_dv_params{1,1}]; % Ideal velocity of mission 1 and 2 Respectively(m/s)
sigma_1 = 0.11; % Stage 1 structural mass fraction
sigma_2 = 0.11; % Stage 2 structural mass fraction
sigma_3 = 0.11; % Stage 3/0 structural mass fraction
isp_1 = 330; % Stage 1 Isp (s)
isp_2 = 380; % Stage 2 Isp (s)
isp_3 = 380; % Stage 3 Isp (s)
%==========================================================================
% code
for j=1:2 % Mission Selection
if j==1
m_0_1 = [];
DV_split = [];
Zephyr_1DV = [];
Zephyr_2DV = [];
for DV_percent1 = 0.15:0.05:0.50
for DV_percent3 = 0.15:0.05:0.50
DV_percent2 = 1-(DV_percent1+DV_percent3);
V_stage3 = V_ideal(j+1)*DV_percent3;
DV_req3 = V_stage3+V_Orbital(j+1);
mu_3 = exp((DV_req3)/(isp_3*g0));
m_p3 = m_payload(j+1)*(((mu_3-1)*(1-sigma_3))./(1-(sigma_3*mu_3)));
m_s3 = m_p3*((sigma_3)/(1-sigma_3));
m_03 = m_p3+m_s3+m_payload(j+1);
V_stage2 = V_ideal(j+1)*DV_percent2;
DV_req2 = V_stage2;
mu_2 = exp((DV_req2)/(isp_2*g0));
m_p2 = m_03.*(((mu_2-1)*(1-sigma_2))./(1-(sigma_2*mu_2)));
m_s2 = m_p2*((sigma_2)/(1-sigma_2));
m_02 = m_p2+m_s2;
V_stage1 = V_ideal(j+1)*DV_percent1;
DV_req1 = V_stage1+V_Recover+V_loss(j+1);
mu_1 = exp((DV_req1)/(isp_1*g0));
m_p1 = (m_02+m_03).*(((mu_1-1)*(1-sigma_1))./(1-(sigma_1*mu_1)));
m_s1 = m_p1*((sigma_1)/(1-sigma_1));
m_01 = m_p1+m_s1;
m_1i = m_01+m_02+m_payload(j);
m_1f = m_s1+m_02+m_payload(j);
DV_req1_1 = isp_1*g0*log(m_1i/m_1f);
m_2i = m_02+m_payload(j);
m_2f = m_s2+m_payload(j);
DV_req2_1 = isp_2*g0*log(m_2i/m_2f);
DV_req_1 = DV_req2_1+DV_req1_1;
if DV_req_1 >= V_ideal(j)+V_loss(j)+V_Recover+V_Orbital(j)
m_0_1 = [m_0_1,m_1i];
DV_split = [DV_split,[DV_percent3;DV_percent2;DV_percent1]];
end
end
end
[m_optimal,I] = min(m_0_1);
Zephyr_mass = m_optimal;
Zephyr_split = DV_split(:,I);
DV_percent3 = Zephyr_split(1);
DV_percent2 = Zephyr_split(2);
DV_percent1 = Zephyr_split(3);
V_stage3 = V_ideal(j+1)*DV_percent3;
DV_req3 = V_stage3+V_Orbital(j+1);
mu_3 = exp((DV_req3)/(isp_3*g0));
m_p3 = m_payload(j+1)*(((mu_3-1)*(1-sigma_3))./(1-(sigma_3*mu_3)));
m_s3 = m_p3*((sigma_3)/(1-sigma_3));
m_03 = m_p3+m_s3+m_payload(j+1);
V_stage2 = V_ideal(j+1)*DV_percent2;
DV_req2 = V_stage2;
mu_2 = exp((DV_req2)/(isp_2*g0));
m_p2 = m_03.*(((mu_2-1)*(1-sigma_2))./(1-(sigma_2*mu_2)));
m_s2 = m_p2*((sigma_2)/(1-sigma_2));
m_02 = m_p2+m_s2;
V_stage1 = V_ideal(j+1)*DV_percent1;
DV_req1 = V_stage1+V_Recover+V_loss(j+1);
mu_1 = exp((DV_req1)/(isp_1*g0));
m_p1 = (m_02+m_03).*(((mu_1-1)*(1-sigma_1))./(1-(sigma_1*mu_1)));
m_s1 = m_p1*((sigma_1)/(1-sigma_1));
m_01 = m_p1+m_s1;
m_0 = m_01+m_02+m_03;
Zephyr_2DV = {'Zephyr Mission 2','Stage 3','Stage 2','Stage 1';'Sigma',sigma_3,sigma_2,sigma_1;'Isp',isp_3,isp_2,isp_1;'%DV Split',DV_percent3,DV_percent2,DV_percent1;'Propellant Mass',m_p3,m_p2,m_p1;'Structural mass',m_s3,m_s2,m_s1;'Total Stage Mass',m_03,m_02,m_01;'Total Mass',' ',' ',m_0};
Zephyr2 = [sigma_3,sigma_2,sigma_1;isp_3,isp_2,isp_1;DV_percent3,DV_percent2,DV_percent1;m_p3,m_p2,m_p1;m_s3,m_s2,m_s1;m_03,m_02,m_01;0,0,m_0];
writecell(Zephyr_2DV,'LVMasses/Zephyr-2MassEstimate.csv')
m_p3 = 0;
m_s3 = 0;
m_03 = 0;
DV_percent3 = 0;
mu_2 = (m_p2+(m_payload(j)*(1-sigma_2)))/((m_p2*sigma_2)+(m_payload(j)*(1-sigma_2)));
DV_req2 = log(mu_2)*isp_2*g0;
V_stage2 = DV_req2-V_Orbital(j);
DV_percent2 = V_stage2/V_ideal(j);
m_02 = m_02+m_payload(j);
mu_1 = (m_p1+(m_02*(1-sigma_1)))/((m_p1*sigma_1)+(m_02*(1-sigma_1)));
DV_req1 = log(mu_1)*isp_1*g0;
V_stage1 = DV_req1-V_Recover-V_loss(j);
DV_percent1 = V_stage1/V_ideal(j);
m_0 = m_01+m_02+m_payload(j);
Zephyr_1DV = {'Zephyr Mission 1','Stage 3','Stage 2','Stage 1';'Sigma',sigma_3,sigma_2,sigma_1;'Isp',isp_3,isp_2,isp_1;'%DV Split',DV_percent3,DV_percent2,DV_percent1;'Propellant Mass',m_p3,m_p2,m_p1;'Structural mass',m_s3,m_s2,m_s1;'Total Stage Mass',m_03,m_02,m_01;'Total Mass',' ',' ',m_0};
Zephyr1 = [sigma_3,sigma_2,sigma_1;isp_3,isp_2,isp_1;DV_percent3,DV_percent2,DV_percent1;m_p3,m_p2,m_p1;m_s3,m_s2,m_s1;m_03,m_02,m_01;0,0,m_0];
writecell(Zephyr_1DV,'LVMasses/Zephyr-1MassEstimate.csv')
end
end