*ARCHIVED* development moved to aircraft-studio.
pack_coord method in Coordinates
Changed files
creator.py
@@ -59,11 +59,12 @@
59
59
self.x_l = []
60
60
self.y_l = []
61
61
# Coordinates x_u, y_u, x_l, y_l packed in single list
62
Removed:
self.coordinates = []
62
Added:
self.coord = []
63
Added:
# The airfoil components know the Coordinates instance's coords
63
64
global parent
64
65
parent = self
65
66
66
Removed:
def print_coord(self, round):
67
Added:
def print_component(self, round):
67
68
"""
68
69
Print all the component's coordinates to the terminal.
69
70
@@ -100,7 +101,13 @@
100
101
self.print_coord(4)
101
102
return None
102
103
104
Added:
def pack_coord(self):
105
Added:
self.coord.append(self.x_u)
106
Added:
self.coord.append(self.y_u)
107
Added:
self.coord.append(self.x_l)
108
Added:
self.coord.append(self.y_l)
103
109
110
Added:
104
111
class Airfoil(Coordinates):
105
112
"""This class enables the creation of a single NACA airfoil."""
106
113
@@ -227,11 +234,7 @@
227
234
self.x_l.append(get_lower_coordinates(x)[0])
228
235
self.y_l.append(get_lower_coordinates(x)[1])
229
236
230
Removed:
self.coordinates.append(self.x_u)
231
Removed:
self.coordinates.append(self.y_u)
232
Removed:
self.coordinates.append(self.x_l)
233
Removed:
self.coordinates.append(self.y_l)
234
Removed:
237
Added:
super().pack_coord()
235
238
return None
236
239
237
240
@@ -271,6 +274,8 @@
271
274
self.y_u.append(y_u[spar_x_u])
272
275
self.x_l.append(x_l[spar_x_l])
273
276
self.y_l.append(y_l[spar_x_l])
277
Added:
278
Added:
super().pack_coord()
274
279
return None
275
280
276
281
@@ -281,17 +286,25 @@
281
286
def __init__(self):
282
287
super().__init__(parent.chord, parent.semi_span)
283
288
284
Removed:
def add_stringer(self, *density):
289
Added:
def add_stringer(self, coordinates, den_u_1, den_u_2, den_l_1, den_l_2):
285
290
"""
286
Removed:
Add stringers to the wing from their distribution density between spars.
287
Removed:
First half of density[] concerns stringer distribution on
291
Added:
Add stringers to the wing from their density distribution.
288
292
289
293
Parameters:
290
Removed:
material: stringer material
291
Removed:
*density:
294
Added:
den_u_1: upper nose stringer density (until first spar)
295
Added:
den_u_2: upper surface stringer density
296
Added:
den_l_1: lower nose stringer density (until first spar)
297
Added:
den_l_2: lower surface stringer density
292
298
299
Added:
Returns:
300
Added:
None
293
301
"""
294
Removed:
302
Added:
# Airfoil surface coordinates
303
Added:
# unpacked from 'coordinates' (list of lists in 'Airfoil').
304
Added:
x_u = coordinates[0]
305
Added:
y_u = coordinates[1]
306
Added:
x_l = coordinates[2]
307
Added:
y_l = coordinates[3]
295
308
# Find interval between leading edge and first upper stringer,
296
309
# from density parameter den_u_1.
297
310
interval = self.spar_x_u[0] / (den_u_1 * self.spar_x_u[0])
main.py
@@ -19,7 +19,7 @@
19
19
import time
20
20
start_time = time.time()
21
21
22
Removed:
CHORD_LENGTH = 100
22
Added:
CHORD_LENGTH = 10
23
23
SEMI_SPAN = 200
24
24
25
25
POP_SIZE = 1
@@ -36,31 +36,30 @@
36
36
af = creator.Airfoil()
37
37
# Define NACA airfoil coordinates
38
38
af.naca(2412)
39
Removed:
# Print coordinates of af to terminal
40
Removed:
af.print_coord(4)
41
39
40
Added:
print(af.coord)
41
Added:
42
42
# Create spar instance
43
43
af.spar = creator.Spar()
44
44
# Define the spar coordinates
45
Removed:
af.spar.add_spar(af.coordinates, 0.15)
46
Removed:
af.spar.add_spar(af.coordinates, 0.55)
45
Added:
af.spar.add_spar(af.coord, 0.15)
46
Added:
af.spar.add_spar(af.coord, 0.55)
47
47
# Print coordinates of af.spar to terminal
48
Removed:
af.spar.print_coord(4)
49
48
50
Removed:
# Create stringer instance
51
Removed:
af.stringer = creator.Stringer()
52
Removed:
# Define the stringer coordinates
53
Removed:
af.stringer.add_stringer(af.coordinates, 0.15)
54
Removed:
af.stringer.add_stringer(af.coordinates, 0.55)
55
Removed:
# Print coordinates of af.stringer to terminal
56
Removed:
af.stringer.print_coord(4)
49
Added:
# # Create stringer instance
50
Added:
# af.stringer = creator.Stringer()
51
Added:
# # Define the stringer coordinates
52
Added:
# af.stringer.add_stringer(af.coordinates, 0.15)
53
Added:
# af.stringer.add_stringer(af.coordinates, 0.55)
54
Added:
# # Print coordinates of af.stringer to terminal
55
Added:
# af.stringer.print_coord(4)
57
56
58
57
# Plot components with matplotlib
59
Removed:
creator.plot(af, af.spar, af.stringer)
58
Added:
creator.plot(af, af.spar)
60
59
61
Removed:
# Save component coordinates
62
Removed:
af.save_coord(SAVE_PATH)
63
Removed:
af.spar.save_coord(SAVE_PATH)
60
Added:
# # Save component coordinates
61
Added:
# af.save_coord(SAVE_PATH)
62
Added:
# af.spar.save_coord(SAVE_PATH)
64
63
65
64
# Print final execution time
66
65
print("--- %s seconds ---" % (time.time() - start_time))