try block for info printing

Commit
7887854ad2ba3fa81defe8641171d25405bdd370
Author
Marius Peter <blendoit@gmail.com>
Author date
Committer
Marius Peter <blendoit@gmail.com>
Committer date
Changed files
creator.py
index 43684007..f7e5964e 100644..100644
@@ -50,6 +50,7 @@
50 50 So, all component classes inherit from class Coordinates.
51 51 """
52 52
53 Added: # Defaults
53 54 chord = 100
54 55 semi_span = 200
55 56
@@ -130,8 +131,6 @@
130 131 def __init__(self):
131 132 # Run 'Coordinates' super class init method with same chord & 1/2 span.
132 133 super().__init__()
133 Removed: self.chord = Coordinates.chord
134 Removed: self.semi_span = Coordinates.semi_span
135 134 # NACA number
136 135 self.naca_num = int()
137 136 # Mean camber line
@@ -244,10 +243,6 @@
244 243 self.thickness = float()
245 244 self.z_start = []
246 245 self.z_end = []
247 Removed: self.dx = float()
248 Removed: self.dz = float()
249 Removed: self.dP_x = float()
250 Removed: self.dP_z = float()
251 246
252 247 def add_coord(self, airfoil, x_loc_percent):
253 248 """
@@ -307,10 +302,6 @@
307 302 self.z_start = []
308 303 self.z_end = []
309 304 self.area = float()
310 Removed: # self.dx = float()
311 Removed: # self.dz = float()
312 Removed: # self.dP_x = float()
313 Removed: # self.dP_z = float()
314 305
315 306 def add_coord(self, airfoil,
316 307 stringer_u_1, stringer_u_2,
evaluator.py
index 2bef652f..87265e99 100644..100644
@@ -42,9 +42,6 @@
42 42 + airfoil.spar.mass
43 43 + airfoil.stringer.mass)
44 44 self.mass_dist = []
45 Removed: # Coordinates
46 Removed: self.x = airfoil.x
47 Removed: self.z = airfoil.z
48 45 # Lift
49 46 self.lift_rectangular = []
50 47 self.lift_elliptical = []
@@ -65,29 +62,33 @@
65 62 name = ' EVALUATOR DATA '
66 63 num_of_dashes = len(name)
67 64
68 Removed: print(num_of_dashes * '-')
69 Removed: print(name)
70 Removed: print('Evaluating:', self.airfoil)
71 Removed: print('Chord length:', self.chord)
72 Removed: print('Semi-span:', self.semi_span)
73 Removed: print('Total airfoil mass:', self.mass_total)
74 Removed: print('Centroid location:\n', np.around(self.centroid, 3))
75 Removed: print('Inertia terms:')
76 Removed: print('I_x:\n', np.around(self.I_['x'], 3))
77 Removed: print('I_z:\n', np.around(self.I_['z'], 3))
78 Removed: print('I_xz:\n', np.around(self.I_['xz'], 3))
79 Removed: print('Spar dP_x:\n', self.spar.dP_x)
80 Removed: print('Spar dP_z:\n', self.spar.dP_z)
81 Removed: print(num_of_dashes * '-')
82 Removed: print('Rectangular lift along semi-span:\n',
83 Removed: np.around(self.lift_rectangular, round))
84 Removed: print('Elliptical lift along semi-span:\n',
85 Removed: np.around(self.lift_elliptical, round))
86 Removed: print('Combined lift along semi-span:\n',
87 Removed: np.around(self.lift_total, round))
88 Removed: print('Distribution of mass along semi-span:\n',
89 Removed: np.around(self.mass_dist, round))
90 Removed: print('Drag along semi-span:\n', np.around(self.drag, round))
65 Added: try:
66 Added: print(num_of_dashes * '-')
67 Added: print(name)
68 Added: print('Evaluating:', self.airfoil)
69 Added: print('Chord length:', self.chord)
70 Added: print('Semi-span:', self.semi_span)
71 Added: print('Total airfoil mass:', self.mass_total)
72 Added: print('Centroid location:\n', np.around(self.centroid, 3))
73 Added: print('Inertia terms:')
74 Added: print('I_x:\n', np.around(self.I_['x'], 3))
75 Added: print('I_z:\n', np.around(self.I_['z'], 3))
76 Added: print('I_xz:\n', np.around(self.I_['xz'], 3))
77 Added: print('Spar dP_x:\n', self.spar.dP_x)
78 Added: print('Spar dP_z:\n', self.spar.dP_z)
79 Added: print(num_of_dashes * '-')
80 Added: print('Rectangular lift along semi-span:\n',
81 Added: np.around(self.lift_rectangular, round))
82 Added: print('Elliptical lift along semi-span:\n',
83 Added: np.around(self.lift_elliptical, round))
84 Added: print('Combined lift along semi-span:\n',
85 Added: np.around(self.lift_total, round))
86 Added: print('Distribution of mass along semi-span:\n',
87 Added: np.around(self.mass_dist, round))
88 Added: print('Drag along semi-span:\n', np.around(self.drag, round))
89 Added: except AttributeError:
90 Added: print(num_of_dashes * '-')
91 Added: print('Cannot print full evaluation. Was the airfoil analyzed?')
91 92 return None
92 93
93 94 def info_save(self, save_path, number):
@@ -246,11 +247,11 @@
246 247 plt.plot(evaluator.chord / 4, 0,
247 248 '.', color='g', markersize=24, label='Quarter-chord')
248 249 # Plot airfoil surfaces
249 Removed: x = [0.98 * x for x in evaluator.x]
250 Removed: y = [0.98 * z for z in evaluator.z]
250 Added: x = [0.98 * x for x in evaluator.airfoil.x]
251 Added: y = [0.98 * z for z in evaluator.airfoil.z]
251 252 plt.fill(x, y, color='w', linewidth='1', fill=False)
252 Removed: x = [1.02 * x for x in evaluator.x]
253 Removed: y = [1.02 * z for z in evaluator.z]
253 Added: x = [1.02 * x for x in evaluator.airfoil.x]
254 Added: y = [1.02 * z for z in evaluator.airfoil.z]
254 255 plt.fill(x, y, color='b', linewidth='1', fill=False)
255 256
256 257 # Plot spars
@@ -279,7 +280,7 @@
279 280 plt.xlabel('X axis')
280 281 plt.ylabel('Z axis')
281 282
282 Removed: plot_bound = max(evaluator.x)
283 Added: plot_bound = max(evaluator.airfoil.x)
283 284 plt.xlim(-0.10 * plot_bound, 1.10 * plot_bound)
284 285 plt.ylim(-(1.10 * plot_bound / 2), (1.10 * plot_bound / 2))
285 286 plt.gca().set_aspect('equal', adjustable='box')