more concise spar & stringer add_coord() arguments

Commit
7868c0af262dce1cafa407f82a476ca70680d87e
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index 0dc0aade..80fffce3 100644..100644
@@ -232,7 +232,7 @@
232 232 def __init__(self):
233 233 super().__init__(parent.chord, parent.semi_span)
234 234
235 Removed: def add_coord(self, airfoil_coord, spar_x):
235 Added: def add_coord(self, airfoil, spar_x):
236 236 '''
237 237 Add a single spar at the % chord location given to function.
238 238
@@ -246,10 +246,10 @@
246 246 '''
247 247 # Airfoil surface coordinates
248 248 # unpacked from 'coordinates' (list of lists in 'Coordinates').
249 Removed: x_u = airfoil_coord[0]
250 Removed: z_u = airfoil_coord[1]
251 Removed: x_l = airfoil_coord[2]
252 Removed: z_l = airfoil_coord[3]
249 Added: x_u = airfoil.coord[0]
250 Added: z_u = airfoil.coord[1]
251 Added: x_l = airfoil.coord[2]
252 Added: z_l = airfoil.coord[3]
253 253 # Scaled spar location with regards to chord
254 254 loc = spar_x * self.chord
255 255 # bisect_left: returns index of first value in x_u > loc.
@@ -277,8 +277,9 @@
277 277 super().__init__(parent.chord, parent.semi_span)
278 278 self.area = float()
279 279
280 Removed: def add_coord(self, airfoil_coord, spar_coord,
281 Removed: stringer_u_1, stringer_u_2, stringer_l_1, stringer_l_2):
280 Added: def add_coord(self, airfoil,
281 Added: stringer_u_1, stringer_u_2,
282 Added: stringer_l_1, stringer_l_2):
282 283 '''
283 284 Add equally distributed stringers to four airfoil locations
284 285 (upper nose, lower nose, upper surface, lower surface).
@@ -297,16 +298,14 @@
297 298
298 299 # Airfoil surface coordinates
299 300 # unpacked from 'coordinates' (list of lists in 'Coordinates').
300 Removed: airfoil_x_u = airfoil_coord[0]
301 Removed: airfoil_z_u = airfoil_coord[1]
302 Removed: airfoil_x_l = airfoil_coord[2]
303 Removed: airfoil_z_l = airfoil_coord[3]
301 Added: airfoil_x_u = airfoil.coord[0]
302 Added: airfoil_z_u = airfoil.coord[1]
303 Added: airfoil_x_l = airfoil.coord[2]
304 Added: airfoil_z_l = airfoil.coord[3]
304 305 # Spar coordinates
305 306 # unpacked from 'coordinates' (list of lists in 'Coordinates').
306 Removed: spar_x_u = spar_coord[0]
307 Removed: spar_z_u = spar_coord[1]
308 Removed: spar_x_l = spar_coord[2]
309 Removed: spar_z_l = spar_coord[3]
307 Added: spar_x_u = airfoil.spar.coord[0]
308 Added: spar_x_l = airfoil.spar.coord[2]
310 309
311 310 # Find distance between leading edge and first upper stringer
312 311 interval = spar_x_u[0] / (stringer_u_1 + 1)
main.py
index 44440263..734b88ae 100644..100644
@@ -34,12 +34,13 @@
34 34
35 35 # Area
36 36 STRINGER_AREA = 0.1 # sqin
37 Added: # Amount of stringers
37 38 TOP_STRINGERS = 8
38 39 BOTTOM_STRINGERS = 6
39 40 NOSE_TOP_STRINGERS = 4
40 41 NOSE_BOTTOM_STRINGERS = 7
41 42
42 Removed: # population information
43 Added: # population information & save path
43 44 POP_SIZE = 1
44 45 SAVE_PATH = 'C:/Users/blend/github/UCLA_MAE_154B/save'
45 46
@@ -69,8 +70,8 @@
69 70 # Create spar instance
70 71 af.spar = creator.Spar()
71 72 # Define the spar coordinates and mass, stored in single spar object
72 Removed: af.spar.add_coord(af.coord, 0.15)
73 Removed: af.spar.add_coord(af.coord, 0.55)
73 Added: af.spar.add_coord(af, 0.15)
74 Added: af.spar.add_coord(af, 0.55)
74 75 af.spar.add_mass(SPAR_MASS)
75 76 # af.spar.info_print(2)
76 77 af.spar.info_save(SAVE_PATH, _)
@@ -78,7 +79,7 @@
78 79 # Create stringer instance
79 80 af.stringer = creator.Stringer()
80 81 # Compute the stringer coordinates from their quantity in each zone
81 Removed: af.stringer.add_coord(af.coord, af.spar.coord,
82 Added: af.stringer.add_coord(af,
82 83 NOSE_TOP_STRINGERS,
83 84 TOP_STRINGERS,
84 85 NOSE_BOTTOM_STRINGERS,