diff options
| -rw-r--r-- | creator.py | 16 | ||||
| -rw-r--r-- | evaluator.py | 29 | ||||
| -rw-r--r-- | main.py | 16 | 
3 files changed, 47 insertions, 14 deletions
| @@ -81,9 +81,9 @@ class Coordinates:          print('Mass:', self.mass)          print('============================')          print('x_u the upper x-coordinates:\n', np.around(self.x_u, round)) -        print('z_u the upper y-coordinates:\n', np.around(self.z_u, round)) +        print('z_u the upper z-coordinates:\n', np.around(self.z_u, round))          print('x_l the lower x-coordinates:\n', np.around(self.x_l, round)) -        print('z_l the lower y-coordinates:\n', np.around(self.z_l, round)) +        print('z_l the lower z-coordinates:\n', np.around(self.z_l, round))          return None      def save_info(self, save_dir_path, number): @@ -123,8 +123,8 @@ class Airfoil(Coordinates):          # NACA number          self.naca_num = int()          # Mean camber line -        self.x_c = []  # Contains only integers from 0 to self.chord -        self.y_c = []  # Contains floats +        self.x_c = [] +        self.y_c = []      def add_naca(self, naca_num):          """ @@ -167,7 +167,7 @@ class Airfoil(Coordinates):              Returns thickness from 1 'x' along the airfoil chord.              """              y_t = 5 * t * self.chord * ( -                +0.2969 * sqrt(x / self.chord) +                + 0.2969 * sqrt(x / self.chord)                  - 0.1260 * (x / self.chord)                  - 0.3516 * (x / self.chord) ** 2                  + 0.2843 * (x / self.chord) ** 3 @@ -213,6 +213,12 @@ class Airfoil(Coordinates):      def add_mass(self, mass):          self.mass = mass +    def print_info(self, round): +        super().print_info(round) +        print('x_c the camber x-coordinates:\n', np.around(self.x_u, round)) +        print('z_c the camber z-coordinates:\n', np.around(self.x_u, round)) +        return None +  class Spar(Coordinates):      """Contains a single spar's location.""" diff --git a/evaluator.py b/evaluator.py index f4768e1..a734c78 100644 --- a/evaluator.py +++ b/evaluator.py @@ -15,6 +15,8 @@  from math import sin, cos, atan, sqrt +# All of these functions take integer arguments and return lists. +  def get_total_mass(*component):      total_mass = float() @@ -23,16 +25,39 @@ def get_total_mass(*component):      return total_mass -def lift_rectangular(lift, semi_span): +def get_lift_rectangular(lift, semi_span):      L_prime = lift / (semi_span * 2)      return L_prime -def lift_elliptical(L_0, y, semi_span): +def get_lift_elliptical(L_0, y, semi_span):      L_prime = L_0 * sqrt(1 - (y / semi_span) ** 2)      return L_prime +def get_lift(rectangular, elliptical): +    F_z = (rectangular + elliptical) / 2 +    return F_z + + +def get_mass_distribution(airfoil, total_mass): +    F_z = [total_mass / airfoil.semi_span +           for x in range(0, airfoil.semi_span)] +    return F_z + + +def get_drag(airfoil, drag): +    # Transform semi-span integer into list +    semi_span = [x for x in range(0, airfoil.semi_span)] +    cutoff = round(0.8 * airfoil.semi_span) + +    F_x = [drag for x in semi_span[0:cutoff]] +    F_x.extend([1.25 * drag for x in semi_span[cutoff:]]) +    # for x in semi_span[cutoff:]: +    #     drag_distribution.append(1.25 * drag) +    return F_x + +  def get_centroid(airfoil):      area = airfoil.stringer.area      numerator = float() @@ -76,22 +76,24 @@ def main():          af.stringer.add_mass(STRINGER_MASS)          # af.stringer.print_info(2) -        print(evaluator.get_total_mass(af, af.spar, af.stringer)) +        # print(evaluator.get_total_mass(af, af.spar, af.stringer)) +        drag = evaluator.get_drag(af, 10) +        total_mass = evaluator.get_total_mass(af, af.spar, af.stringer) +        dist_mass = evaluator.get_mass_distribution(af, total_mass) +        print(total_mass) +        print(dist_mass)          # Plot components with matplotlib          creator.plot(af, af.spar, af.stringer)          # Save component info -        af.save_info(SAVE_PATH, _) -        af.spar.save_info(SAVE_PATH, _) -        af.stringer.save_info(SAVE_PATH, _) +        # af.save_info(SAVE_PATH, _) +        # af.spar.save_info(SAVE_PATH, _) +        # af.stringer.save_info(SAVE_PATH, _)      # Evaluate previously created airfoil(s).      # total_mass = evaluator.get_total_mass(af, af.spar, af.stringer) -    # Iteratively evaluate airfoils by defining genetic generations. -    # pass -      # Print final execution time      print("--- %s seconds ---" % (time.time() - start_time)) | 
