*ARCHIVED* development moved to aircraft-studio.
remove unused exception catching
Changed files
creator.py
@@ -243,7 +243,7 @@
243
243
# Scaled spar location with regards to chord
244
244
loc = spar_x * self.chord
245
245
# bisect_left: returns index of first value in x_u > loc.
246
Removed:
# This ensures that the spar coordinates intersect with airfoil surface.
246
Added:
# Ensures that the spar coordinates intersect with airfoil surface.
247
247
spar_x_u = bi.bisect_left(x_u, loc) # index of spar's x_u
248
248
spar_x_l = bi.bisect_left(x_l, loc) # index of spar's x_l
249
249
# These x and y coordinates are assigned to the spar, NOT airfoil.
@@ -374,29 +374,22 @@
374
374
plt.plot(airfoil.x_l, airfoil.z_l, '', color='b', linewidth='1')
375
375
376
376
# Plot spars
377
Removed:
try:
378
Removed:
for _ in range(0, len(spar.x_u)):
379
Removed:
x = (spar.x_u[_], spar.x_l[_])
380
Removed:
y = (spar.z_u[_], spar.z_l[_])
381
Removed:
plt.plot(x, y, '.-', color='b')
382
Removed:
# plt.legend()
383
Removed:
except:
384
Removed:
print('Did not plot spars. Were they added?')
377
Added:
for _ in range(0, len(spar.x_u)):
378
Added:
x = (spar.x_u[_], spar.x_l[_])
379
Added:
y = (spar.z_u[_], spar.z_l[_])
380
Added:
plt.plot(x, y, '.-', color='b')
385
381
386
382
# Plot stringers
387
Removed:
try:
388
Removed:
# Upper stringers
389
Removed:
for _ in range(0, len(stringer.x_u)):
390
Removed:
x = stringer.x_u[_]
391
Removed:
y = stringer.z_u[_]
392
Removed:
plt.plot(x, y, '.', color='y')
393
Removed:
# Lower stringers
394
Removed:
for _ in range(0, len(stringer.x_l)):
395
Removed:
x = stringer.x_l[_]
396
Removed:
y = stringer.z_l[_]
397
Removed:
plt.plot(x, y, '.', color='y')
398
Removed:
except:
399
Removed:
print('Unable to plot stringers. Were they created?')
383
Added:
# Upper stringers
384
Added:
for _ in range(0, len(stringer.x_u)):
385
Added:
x = stringer.x_u[_]
386
Added:
y = stringer.z_u[_]
387
Added:
plt.plot(x, y, '.', color='y')
388
Added:
# Lower stringers
389
Added:
for _ in range(0, len(stringer.x_l)):
390
Added:
x = stringer.x_l[_]
391
Added:
y = stringer.z_l[_]
392
Added:
plt.plot(x, y, '.', color='y')
400
393
401
394
# Graph formatting
402
395
plt.gca().set_aspect('equal', adjustable='box')
main.py
@@ -21,10 +21,12 @@
21
21
import time
22
22
start_time = time.time()
23
23
24
Removed:
CHORD_LENGTH = 10
24
Added:
# Airfoil dimensions
25
Added:
NACA_NUM = 4412
26
Added:
CHORD_LENGTH = 100
25
27
SEMI_SPAN = 200
26
28
27
Removed:
# m=Mass
29
Added:
# Component masses
28
30
AIRFOIL_MASS = 100 # lbs
29
31
SPAR_MASS = 10 # lbs
30
32
STRINGER_MASS = 5 # lbs
@@ -54,9 +56,9 @@
54
56
# Create airfoil instance
55
57
af = creator.Airfoil()
56
58
# Define NACA airfoil coordinates and mass
57
Removed:
af.add_naca(2412)
59
Added:
af.add_naca(NACA_NUM)
58
60
af.add_mass(AIRFOIL_MASS)
59
Removed:
af.print_info(2)
61
Added:
# af.print_info(2)
60
62
61
63
# Create spar instance
62
64
af.spar = creator.Spar()
@@ -64,7 +66,7 @@
64
66
af.spar.add_coord(af.coord, 0.15)
65
67
af.spar.add_coord(af.coord, 0.55)
66
68
af.spar.add_mass(SPAR_MASS)
67
Removed:
af.spar.print_info(2)
69
Added:
# af.spar.print_info(2)
68
70
69
71
# Create stringer instance
70
72
af.stringer = creator.Stringer()
@@ -72,10 +74,10 @@
72
74
af.stringer.add_coord(af.coord, af.spar.coord, 4, 7, 5, 6)
73
75
af.stringer.add_area(STRINGER_AREA)
74
76
af.stringer.add_mass(STRINGER_MASS)
75
Removed:
af.stringer.print_info(2)
77
Added:
# af.stringer.print_info(2)
76
78
77
79
# Plot components with matplotlib
78
Removed:
# creator.plot(af, af.spar, af.stringer)
80
Added:
creator.plot(af, af.spar, af.stringer)
79
81
80
82
# Save component info
81
83
af.save_info(SAVE_PATH, _)