diff options
| -rw-r--r-- | creator.py | 10 | ||||
| -rw-r--r-- | evaluator.py | 18 | ||||
| -rw-r--r-- | main.py | 12 | 
3 files changed, 22 insertions, 18 deletions
| @@ -232,7 +232,7 @@ class Airfoil(Coordinates):          y_chord = [0, 0]          plt.plot(x_chord, y_chord, linewidth='1')          # Plot quarter chord -        plt.plot(self.chord / 4, 0, '.', color='g') +        plt.plot(self.chord / 4, 0, '.', color='g', markersize=24)          # Plot mean camber line          plt.plot(self.x_c, self.y_c,                   '-.', color='r', linewidth='2', @@ -255,12 +255,12 @@ class Airfoil(Coordinates):          for _ in range(0, len(self.stringer.x_u)):              x = self.stringer.x_u[_]              y = self.stringer.z_u[_] -            plt.plot(x, y, '.', color='y') +            plt.plot(x, y, '.', color='y', markersize=12)          # Lower stringers          for _ in range(0, len(self.stringer.x_l)):              x = self.stringer.x_l[_]              y = self.stringer.z_l[_] -            plt.plot(x, y, '.', color='y') +            plt.plot(x, y, '.', color='y', markersize=12)          # Graph formatting          plt.xlabel('X axis') @@ -271,9 +271,7 @@ class Airfoil(Coordinates):          plt.ylim(- (1.10 * plot_bound / 2), (1.10 * plot_bound / 2))          plt.gca().set_aspect('equal', adjustable='box')          plt.grid(axis='both', linestyle=':', linewidth=1) -        plt.draw() -        plt.pause(1) -        # plt.close() +        plt.show()          return None diff --git a/evaluator.py b/evaluator.py index 9a54120..56ce7a0 100644 --- a/evaluator.py +++ b/evaluator.py @@ -95,10 +95,6 @@ class Airfoil:                    'Was the full path passed to the function?')          return None -    # def get_mass_total(airfoil): -    #     total_mass = airfoil.mass + airfoil.spar.mass + airfoil.stringer.mass -    #     return total_mass -      # All these functions take integer arguments and return lists.      def get_lift_rectangular(self, lift): @@ -134,7 +130,9 @@ class Airfoil:          return F_x      def get_centroid(self): +        '''Return the coordinates of the centroid.'''          area = self.airfoil.stringer.area +          x_stringers = self.airfoil.stringer.x_u + self.airfoil.stringer.x_l          x_centroid = sum([x * area for x in x_stringers]) / \              (len(x_stringers) * area) @@ -165,7 +163,8 @@ class Airfoil:          y_chord = [0, 0]          plt.plot(x_chord, y_chord, linewidth='1')          # Plot quarter chord -        plt.plot(self.chord / 4, 0, '.', color='g', markersize=24) +        q = self.chord / 4 +        plt.plot(q, 0, '.', color='g', markersize=24, label='quarter-chord')          # Plot upper surface          plt.plot(self.x_u, self.z_u,                   '', color='b', linewidth='1') @@ -179,22 +178,21 @@ class Airfoil:              y = (self.spar.z_u[_], self.spar.z_l[_])              plt.plot(x, y, '.-', color='b') -        # Plot stringers -        # Upper stringers +        # Plot upper stringers          for _ in range(0, len(self.stringer.x_u)):              x = self.stringer.x_u[_]              y = self.stringer.z_u[_]              plt.plot(x, y, '.', color='y', markersize=12) -        # Lower stringers +        # Plot lower stringers          for _ in range(0, len(self.stringer.x_l)):              x = self.stringer.x_l[_]              y = self.stringer.z_l[_]              plt.plot(x, y, '.', color='y', markersize=12) -        # Centroid +        # Plot centroid          x = self.centroid[0]          y = self.centroid[1] -        plt.plot(x, y, '.', color='r', markersize=24) +        plt.plot(x, y, '.', color='r', markersize=24, label='centroid')          # Graph formatting          plt.xlabel('X axis') @@ -32,7 +32,11 @@ SPAR_MASS = 10  # lbs  STRINGER_MASS = 5  # lbs  # Area -STRINGER_AREA = 0.1  # sqin +STRINGER_AREA = 1  # sqin +TOP_STRINGERS = 4 +BOTTOM_STRINGERS = 6 +NOSE_TOP_STRINGERS = 4 +NOSE_BOTTOM_STRINGERS = 7  # population information  POP_SIZE = 1 @@ -73,7 +77,11 @@ def main():          # Create stringer instance          af.stringer = creator.Stringer()          # Compute the stringer coordinates from their quantity in each zone -        af.stringer.add_coord(af.coord, af.spar.coord, 4, 7, 5, 6) +        af.stringer.add_coord(af.coord, af.spar.coord, +                              NOSE_TOP_STRINGERS, +                              TOP_STRINGERS, +                              NOSE_BOTTOM_STRINGERS, +                              BOTTOM_STRINGERS)          af.stringer.add_area(STRINGER_AREA)          af.stringer.add_mass(STRINGER_MASS)          # af.stringer.info_print(2) | 
