summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--creator.py29
-rw-r--r--main.py9
2 files changed, 19 insertions, 19 deletions
diff --git a/creator.py b/creator.py
index 0dc0aad..80fffce 100644
--- a/creator.py
+++ b/creator.py
@@ -232,7 +232,7 @@ class Spar(Coordinates):
def __init__(self):
super().__init__(parent.chord, parent.semi_span)
- def add_coord(self, airfoil_coord, spar_x):
+ def add_coord(self, airfoil, spar_x):
'''
Add a single spar at the % chord location given to function.
@@ -246,10 +246,10 @@ class Spar(Coordinates):
'''
# Airfoil surface coordinates
# unpacked from 'coordinates' (list of lists in 'Coordinates').
- x_u = airfoil_coord[0]
- z_u = airfoil_coord[1]
- x_l = airfoil_coord[2]
- z_l = airfoil_coord[3]
+ x_u = airfoil.coord[0]
+ z_u = airfoil.coord[1]
+ x_l = airfoil.coord[2]
+ z_l = airfoil.coord[3]
# Scaled spar location with regards to chord
loc = spar_x * self.chord
# bisect_left: returns index of first value in x_u > loc.
@@ -277,8 +277,9 @@ class Stringer(Coordinates):
super().__init__(parent.chord, parent.semi_span)
self.area = float()
- def add_coord(self, airfoil_coord, spar_coord,
- stringer_u_1, stringer_u_2, stringer_l_1, stringer_l_2):
+ def add_coord(self, airfoil,
+ stringer_u_1, stringer_u_2,
+ stringer_l_1, stringer_l_2):
'''
Add equally distributed stringers to four airfoil locations
(upper nose, lower nose, upper surface, lower surface).
@@ -297,16 +298,14 @@ class Stringer(Coordinates):
# Airfoil surface coordinates
# unpacked from 'coordinates' (list of lists in 'Coordinates').
- airfoil_x_u = airfoil_coord[0]
- airfoil_z_u = airfoil_coord[1]
- airfoil_x_l = airfoil_coord[2]
- airfoil_z_l = airfoil_coord[3]
+ airfoil_x_u = airfoil.coord[0]
+ airfoil_z_u = airfoil.coord[1]
+ airfoil_x_l = airfoil.coord[2]
+ airfoil_z_l = airfoil.coord[3]
# Spar coordinates
# unpacked from 'coordinates' (list of lists in 'Coordinates').
- spar_x_u = spar_coord[0]
- spar_z_u = spar_coord[1]
- spar_x_l = spar_coord[2]
- spar_z_l = spar_coord[3]
+ spar_x_u = airfoil.spar.coord[0]
+ spar_x_l = airfoil.spar.coord[2]
# Find distance between leading edge and first upper stringer
interval = spar_x_u[0] / (stringer_u_1 + 1)
diff --git a/main.py b/main.py
index 4444026..734b88a 100644
--- a/main.py
+++ b/main.py
@@ -34,12 +34,13 @@ STRINGER_MASS = 5 # lbs
# Area
STRINGER_AREA = 0.1 # sqin
+# Amount of stringers
TOP_STRINGERS = 8
BOTTOM_STRINGERS = 6
NOSE_TOP_STRINGERS = 4
NOSE_BOTTOM_STRINGERS = 7
-# population information
+# population information & save path
POP_SIZE = 1
SAVE_PATH = 'C:/Users/blend/github/UCLA_MAE_154B/save'
@@ -69,8 +70,8 @@ def main():
# Create spar instance
af.spar = creator.Spar()
# Define the spar coordinates and mass, stored in single spar object
- af.spar.add_coord(af.coord, 0.15)
- af.spar.add_coord(af.coord, 0.55)
+ af.spar.add_coord(af, 0.15)
+ af.spar.add_coord(af, 0.55)
af.spar.add_mass(SPAR_MASS)
# af.spar.info_print(2)
af.spar.info_save(SAVE_PATH, _)
@@ -78,7 +79,7 @@ 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,
+ af.stringer.add_coord(af,
NOSE_TOP_STRINGERS,
TOP_STRINGERS,
NOSE_BOTTOM_STRINGERS,
Copyright 2019--2024 Marius PETER