*ARCHIVED* development moved to aircraft-studio.
add_mass method in class Coordinates
Changed files
creator.py
@@ -50,6 +50,8 @@
50
50
if chord < 10:
51
51
self.chord = 10
52
52
self.semi_span = semi_span
53
Added:
# mass
54
Added:
self.mass = float()
53
55
# Component material
54
56
self.material = str()
55
57
# Upper coordinates
@@ -60,6 +62,7 @@
60
62
self.y_l = []
61
63
# Coordinates x_u, y_u, x_l, y_l packed in single list
62
64
self.coord = []
65
Added:
63
66
# The airfoil components know the Coordinates instance's coords
64
67
global parent
65
68
parent = self
@@ -67,6 +70,9 @@
67
70
def __str__(self):
68
71
return type(self).__name__
69
72
73
Added:
def add_mass(self, mass):
74
Added:
self.mass = len(self.x_u) * mass
75
Added:
70
76
def print_coord(self, round):
71
77
"""
72
78
Print all the component's coordinates to the terminal.
@@ -249,7 +255,7 @@
249
255
def __init__(self):
250
256
super().__init__(parent.chord, parent.semi_span)
251
257
252
Removed:
def add(self, airfoil_coord, spar_x):
258
Added:
def add_coord(self, airfoil_coord, spar_x):
253
259
"""
254
260
Add a single spar at the % chord location given to function.
255
261
@@ -290,8 +296,8 @@
290
296
def __init__(self):
291
297
super().__init__(parent.chord, parent.semi_span)
292
298
293
Removed:
def add(self, airfoil_coord, spar_coord, stringer_u_1, stringer_u_2,
294
Removed:
stringer_l_1, stringer_l_2):
299
Added:
def add_coord(self, airfoil_coord, spar_coord, stringer_u_1, stringer_u_2,
300
Added:
stringer_l_1, stringer_l_2):
295
301
"""
296
302
Add equally distributed stringers to four airfoil locations
297
303
(upper nose, lower nose, upper surface, lower surface).
main.py
@@ -21,9 +21,14 @@
21
21
import time
22
22
start_time = time.time()
23
23
24
Removed:
CHORD_LENGTH = 1000
24
Added:
CHORD_LENGTH = 10
25
25
SEMI_SPAN = 200
26
26
27
Added:
# masss
28
Added:
AIRFOIL_MASS = 100 # lbs
29
Added:
SPAR_MASS = 10 # lbs
30
Added:
STRINGER_MASS = 5 # lbs
31
Added:
27
32
POP_SIZE = 1
28
33
SAVE_PATH = 'C:/Users/blend/github/UCLA_MAE_154B/save'
29
34
@@ -37,23 +42,25 @@
37
42
38
43
# Create airfoil instance
39
44
af = creator.Airfoil()
40
Removed:
# Define NACA airfoil coordinates
45
Added:
# Define NACA airfoil coordinates and mass
41
46
af.add_naca(2412)
42
Removed:
# af.print_coord(2)
47
Added:
af.add_mass(AIRFOIL_MASS)
48
Added:
af.print_coord(2)
43
49
44
50
# Create spar instance
45
51
af.spar = creator.Spar()
46
Removed:
# Define the spar coordinates, stored in single spar object
47
Removed:
af.spar.add(af.coord, 0.15)
48
Removed:
af.spar.add(af.coord, 0.55)
49
Removed:
# af.spar.print_coord(2)
52
Added:
# Define the spar coordinates and mass, stored in single spar object
53
Added:
af.spar.add_coord(af.coord, 0.15)
54
Added:
af.spar.add_coord(af.coord, 0.55)
55
Added:
af.spar.add_mass(SPAR_MASS)
56
Added:
af.spar.print_coord(2)
50
57
51
58
# Create stringer instance
52
59
af.stringer = creator.Stringer()
53
Removed:
# Define the stringer coordinates from their amount
54
Removed:
af.stringer.add(af.coord, af.spar.coord, 4, 7, 5, 6)
55
Removed:
# Print coordinates of af.stringer to terminal
56
Removed:
# af.stringer.print_coord(2)
60
Added:
# Compute the stringer coordinates from their quantity in each zone
61
Added:
af.stringer.add_coord(af.coord, af.spar.coord, 4, 7, 5, 6)
62
Added:
af.stringer.add_mass(STRINGER_MASS)
63
Added:
af.stringer.print_coord(2)
57
64
58
65
# Plot components with matplotlib
59
66
# creator.plot(af, af.spar, af.stringer)