From 9a033eb0777c63537334c5cbff1fc6499b7f7650 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sat, 8 Jun 2019 20:00:40 -0700 Subject: Fixed spar plotting --- creator.py | 9 ++++----- main.py | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/creator.py b/creator.py index d5ff3ec..b1a58a9 100644 --- a/creator.py +++ b/creator.py @@ -242,7 +242,7 @@ class Spar(Coordinates): def __init__(self): super().__init__(parent.chord, parent.semi_span) - def add_spar(self, coordinates, material, spar_x): + def add_spar(self, coordinates, spar_x): """ Add a single spar at the % chord location given to function. @@ -271,7 +271,6 @@ class Spar(Coordinates): self.y_u.append(y_u[spar_x_u]) self.x_l.append(x_l[spar_x_l]) self.y_l.append(y_l[spar_x_l]) - self.spar_material = material return None @@ -286,7 +285,7 @@ class Stringer(): self.stringer_y_l = [] self.stringer_mat = [] - def add_stringers(self, material, *density): + def add_stringers(self, *density): """ Add stringers to the wing from their distribution density between spars. First half of density[] concerns stringer distribution on @@ -347,8 +346,8 @@ def plot(airfoil, spar): # Plot spars try: for _ in range(0, len(spar.x_u)): - x = (spar.spar_x_u[_], spar.spar_x_l[_]) - y = (spar.spar_y_u[_], spar.spar_y_l[_]) + x = (spar.x_u[_], spar.x_l[_]) + y = (spar.y_u[_], spar.y_l[_]) plt.plot(x, y, '.-', color='b', label='spar') plt.legend() except: diff --git a/main.py b/main.py index a6e75a3..f62a88a 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ import random import time start_time = time.time() -CHORD_LENGTH = 40 +CHORD_LENGTH = 100 SEMI_SPAN = 200 POP_SIZE = 1 @@ -41,7 +41,8 @@ def main(): # Create spar instance af.spar = creator.Spar() # Define the spar coordinates - af.spar.add_spar(af.coordinates, 'aluminium', 0.15) + af.spar.add_spar(af.coordinates, 0.15) + af.spar.add_spar(af.coordinates, 0.55) # Print coordinates of af.spar to terminal af.spar.print_coord(4) # Plot components with matplotlib -- cgit v1.2.3