Newer
Older
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 19:51:18 2019
@author: MAC
"""
import Engineering_tools as et
RETROGRADE_ORBIT = 90
class Rocket():
def __init__(self, stage1, stage2, payload, launch_coordinates):
"""stage1 and stage2 are instances of the class Stage,
payload is an instance of the class Payload,
launch_coordinates = {latitude(deg), longitude(deg)}
:param stage1: [description]
:type stage1: [type]
:param stage2: [description]
:type stage2: [type]
:param payload: [description]
:type payload: Payload
:param launch_coordinates: [description]
:type launch_coordinates: [type]
"""
self.stage1 = stage1
self.stage2 = stage2
self.payload = payload
self.injection_velocity = et.final_target_vel(self.payload.perigee_altitude,
self.payload.target_orbit.a)
self.launch_coordinates = launch_coordinates
if self.payload.target_orbit.i > RETROGRADE_ORBIT: # retrograade orbit
self.initial_velocity = et.initial_vel(self.launch_coordinates['latitude'],retrograde=True)
else:
self.initial_velocity = et.initial_vel(self.launch_coordinates['longitude'])
def target_Vc(self, p_losses):
"""Compute the target critical velocity losses : velocity losses approximation (m.s-1)
:param p_losses: [description]
:type p_losses: [type]
"""
self.target_Vc = self.injection_velocity - self.initial_velocity + p_losses
def __str__(self):
return 'Rocket'
class Stage():
def __init__(self, stage_number, number_of_engines = 9, avionics_mass=0):
"""
stage_number : 1 or 2
"""
self.stage_number = stage_number
self.number_of_engines = number_of_engines
self.avionics_mass = 0
def tank_mass(self):
pass
def __str__(self):
return 'Stage'
class Payload():
def __init__(self, mass, target_orbit):
""" Payload
:param mass: [description]
:type mass: [type]
:param target_orbit: [description]
:type target_orbit: TargetOrbit
"""
self.mass = mass
self.target_orbit = target_orbit
self.perigee_altitude = target_orbit.a * (1 - target_orbit.e)
def __str__(self):
return 'Payload'
class Engine():
"""
"""
cycle_type=''
def __init__(self, oxidiser, fuel, thermo_cycle, exit_section_area):
"""
"""
self.oxidiser = oxidiser
self.fuel = fuel
self.thermo_cycle = thermo_cycle
self.exit_section_area = exit_section_area
def __str__(self):
return 'Engine'
class TargetOrbit():
def __init__(self, a, e, i, capital_omega, small_omega, nu):
"""[summary]
:param a: semi_major axis (m)
:type a: [type]
:param e: eccentricity (adimentional)
:type e: [type]
:param i: inclination (deg)
:type i: [type]
:param capital_omega: argument of the ascending node (deg)
:type capital_omega: [type]
:param small_omega: argument of the perigee (deg)
:type small_omega: [type]
:param nu: [description]
:type nu: [type]
"""
self.a = a
self.e = e
self.i = i
self.capital_omega = capital_omega
self.small_omega = small_omega
self.nu = nu
def __str__(self):
return ("TargetOrbit object\n"
"Semi major axis : {}\n"
"Exccentricity : {}\n"
"Inclination : {}\n"
"Argument of ascending node : {}\n"
"Argument of periapsis : {}\n"
"nu ? : {}\n").format(self.a,self.e,self.i,self.capital_omega,self.small_omega,self.nu)
if __name__ == '__main__':
v_semiMajorAxis = 400000 # 400 km
v_eccentricity = 15
v_inclination = 20
v_ascendingNode = 5
v_perigee = 5
v_nu = 0
v_targetOrbit = TargetOrbit(v_semiMajorAxis, v_eccentricity, v_inclination, v_ascendingNode, v_perigee, v_nu)
print(v_targetOrbit)
v_payload = Payload(400, v_targetOrbit)
Rocket(Stage(1), Stage(2), v_payload, {'latitude':47,'longitude':2})