summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--creator.py11
-rw-r--r--evaluator.py63
2 files changed, 33 insertions, 41 deletions
diff --git a/creator.py b/creator.py
index 4368400..f7e5964 100644
--- a/creator.py
+++ b/creator.py
@@ -50,6 +50,7 @@ class Coordinates:
So, all component classes inherit from class Coordinates.
"""
+ # Defaults
chord = 100
semi_span = 200
@@ -130,8 +131,6 @@ class Airfoil(Coordinates):
def __init__(self):
# Run 'Coordinates' super class init method with same chord & 1/2 span.
super().__init__()
- self.chord = Coordinates.chord
- self.semi_span = Coordinates.semi_span
# NACA number
self.naca_num = int()
# Mean camber line
@@ -244,10 +243,6 @@ class Spar(Coordinates):
self.thickness = float()
self.z_start = []
self.z_end = []
- self.dx = float()
- self.dz = float()
- self.dP_x = float()
- self.dP_z = float()
def add_coord(self, airfoil, x_loc_percent):
"""
@@ -307,10 +302,6 @@ class Stringer(Coordinates):
self.z_start = []
self.z_end = []
self.area = float()
- # self.dx = float()
- # self.dz = float()
- # self.dP_x = float()
- # self.dP_z = float()
def add_coord(self, airfoil,
stringer_u_1, stringer_u_2,
diff --git a/evaluator.py b/evaluator.py
index 2bef652..87265e9 100644
--- a/evaluator.py
+++ b/evaluator.py
@@ -42,9 +42,6 @@ class Evaluator:
+ airfoil.spar.mass
+ airfoil.stringer.mass)
self.mass_dist = []
- # Coordinates
- self.x = airfoil.x
- self.z = airfoil.z
# Lift
self.lift_rectangular = []
self.lift_elliptical = []
@@ -65,29 +62,33 @@ class Evaluator:
name = ' EVALUATOR DATA '
num_of_dashes = len(name)
- print(num_of_dashes * '-')
- print(name)
- print('Evaluating:', self.airfoil)
- print('Chord length:', self.chord)
- print('Semi-span:', self.semi_span)
- print('Total airfoil mass:', self.mass_total)
- print('Centroid location:\n', np.around(self.centroid, 3))
- print('Inertia terms:')
- print('I_x:\n', np.around(self.I_['x'], 3))
- print('I_z:\n', np.around(self.I_['z'], 3))
- print('I_xz:\n', np.around(self.I_['xz'], 3))
- print('Spar dP_x:\n', self.spar.dP_x)
- print('Spar dP_z:\n', self.spar.dP_z)
- print(num_of_dashes * '-')
- print('Rectangular lift along semi-span:\n',
- np.around(self.lift_rectangular, round))
- print('Elliptical lift along semi-span:\n',
- np.around(self.lift_elliptical, round))
- print('Combined lift along semi-span:\n',
- np.around(self.lift_total, round))
- print('Distribution of mass along semi-span:\n',
- np.around(self.mass_dist, round))
- print('Drag along semi-span:\n', np.around(self.drag, round))
+ try:
+ print(num_of_dashes * '-')
+ print(name)
+ print('Evaluating:', self.airfoil)
+ print('Chord length:', self.chord)
+ print('Semi-span:', self.semi_span)
+ print('Total airfoil mass:', self.mass_total)
+ print('Centroid location:\n', np.around(self.centroid, 3))
+ print('Inertia terms:')
+ print('I_x:\n', np.around(self.I_['x'], 3))
+ print('I_z:\n', np.around(self.I_['z'], 3))
+ print('I_xz:\n', np.around(self.I_['xz'], 3))
+ print('Spar dP_x:\n', self.spar.dP_x)
+ print('Spar dP_z:\n', self.spar.dP_z)
+ print(num_of_dashes * '-')
+ print('Rectangular lift along semi-span:\n',
+ np.around(self.lift_rectangular, round))
+ print('Elliptical lift along semi-span:\n',
+ np.around(self.lift_elliptical, round))
+ print('Combined lift along semi-span:\n',
+ np.around(self.lift_total, round))
+ print('Distribution of mass along semi-span:\n',
+ np.around(self.mass_dist, round))
+ print('Drag along semi-span:\n', np.around(self.drag, round))
+ except AttributeError:
+ print(num_of_dashes * '-')
+ print('Cannot print full evaluation. Was the airfoil analyzed?')
return None
def info_save(self, save_path, number):
@@ -246,11 +247,11 @@ def plot_geom(evaluator):
plt.plot(evaluator.chord / 4, 0,
'.', color='g', markersize=24, label='Quarter-chord')
# Plot airfoil surfaces
- x = [0.98 * x for x in evaluator.x]
- y = [0.98 * z for z in evaluator.z]
+ x = [0.98 * x for x in evaluator.airfoil.x]
+ y = [0.98 * z for z in evaluator.airfoil.z]
plt.fill(x, y, color='w', linewidth='1', fill=False)
- x = [1.02 * x for x in evaluator.x]
- y = [1.02 * z for z in evaluator.z]
+ x = [1.02 * x for x in evaluator.airfoil.x]
+ y = [1.02 * z for z in evaluator.airfoil.z]
plt.fill(x, y, color='b', linewidth='1', fill=False)
# Plot spars
@@ -279,7 +280,7 @@ def plot_geom(evaluator):
plt.xlabel('X axis')
plt.ylabel('Z axis')
- plot_bound = max(evaluator.x)
+ plot_bound = max(evaluator.airfoil.x)
plt.xlim(-0.10 * plot_bound, 1.10 * plot_bound)
plt.ylim(-(1.10 * plot_bound / 2), (1.10 * plot_bound / 2))
plt.gca().set_aspect('equal', adjustable='box')
Copyright 2019--2024 Marius PETER