summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblendoit <blendoit@gmail.com>2019-10-06 15:14:53 -0700
committerblendoit <blendoit@gmail.com>2019-10-06 15:14:53 -0700
commit8202fe7e323b3f2ade911a828d4737b6ab34689f (patch)
treea1c58b913d5c527e2b640c9dc6260ef74bee493f
parentbdf09276e757675e9c9d7874b46bdffdb137e3b8 (diff)
Before Evaluator in-depth rewrite
-rw-r--r--README.org5
-rw-r--r--creator/base.py6
-rw-r--r--evaluator.py79
-rw-r--r--example_airfoil.py7
4 files changed, 53 insertions, 44 deletions
diff --git a/README.org b/README.org
index ba5fa66..2b97a82 100644
--- a/README.org
+++ b/README.org
@@ -9,11 +9,6 @@ With the final objective of designing a lightweight FAR 23 compliant airfoil.
I adapted it from my own code for the UCLA MAE 154B final project (Spring 2019).
-#+BEGIN_UML
-Alice -> Bob: Authentication Request
-Bob --> Alice: Authentication Response
-#+END_UML
-
#+CAPTION: Program Flow Sequence
#+NAME: fig:sequence-program
[[./doc/sequence_program.png]]
diff --git a/creator/base.py b/creator/base.py
index 603bef7..c46b297 100644
--- a/creator/base.py
+++ b/creator/base.py
@@ -12,15 +12,17 @@ logging.basicConfig(filename='log.txt',
class Aircraft:
"""This class tracks all sub-components and is fed to the evaluator."""
- def __init__(self, parent):
+ def __init__(self, parent, name):
self.parent = parent
+ self.name = name
+ parent.aircrafts.append(name)
class Component:
"""Basic component providing coordinates and tools."""
def __init__(self, parent, name):
- self.name = str()
self.parent = None
+ self.name = name
self.x = np.array([])
self.z = np.array([])
self.material = None
diff --git a/evaluator.py b/evaluator.py
index afbde9c..aac7f61 100644
--- a/evaluator.py
+++ b/evaluator.py
@@ -13,49 +13,58 @@ import matplotlib.pyplot as plt
class Evaluator:
- """Performs structural evaluations for the airfoil passed as argument."""
- def __init__(self, aircraft):
- # Evaluator knows all geometrical info from evaluated airfoil
- self.airfoil = self.get_airfoil(aircraft)
- self.spars = self.get_spars(aircraft)
- self.stringers = self.get_stringers(aircraft)
- # Lift
- self.lift_rectangular = []
- self.lift_elliptical = []
- self.lift_total = []
- # Drag
- self.drag = []
- # centroid
- self.centroid = []
+ """Performs structural evaluations on aircrafts.
+ Individual aircrafts must claim an Evaluator object as parent."""
+ def __init__(self):
+ self.aircrafts = []
+ # # Evaluator knows all geometrical info from evaluated airfoil
+ # self.airfoil = self.get_airfoil(aircraft)
+ # self.spars = self.get_spars(aircraft)
+ # self.stringers = self.get_stringers(aircraft)
+ # # Lift
+ # self.lift_rectangular = []
+ # self.lift_elliptical = []
+ # self.lift_total = []
+ # # Drag
+ # self.drag = []
+ # # centroid
+ # self.centroid = []
# Inertia terms:
self.I_ = {'x': 0, 'z': 0, 'xz': 0}
def __str__(self):
return type(self).__name__
- def get_airfoil(self, aircraft):
- """Get data of spars belonging to aircraft."""
+ def update(self):
+ """Get all aircrafts' data."""
try:
- pass
+ print(self.aircrafts)
except:
- pass
- pass
-
- def get_spars(self, aircraft):
- """Get data of spars belonging to aircraft."""
- try:
- pass
- except:
- pass
- pass
-
- def get_stringers(self, aircraft):
- """Get data of spars belonging to aircraft."""
- try:
- pass
- except:
- pass
- pass
+ print("failed!")
+
+ # def get_airfoil(self, aircraft):
+ # """Get data of spars belonging to aircraft."""
+ # try:
+ # pass
+ # except:
+ # pass
+ # pass
+
+ # def get_spars(self, aircraft):
+ # """Get data of spars belonging to aircraft."""
+ # try:
+ # pass
+ # except:
+ # pass
+ # pass
+
+ # def get_stringers(self, aircraft):
+ # """Get data of spars belonging to aircraft."""
+ # try:
+ # pass
+ # except:
+ # pass
+ # pass
def info_print(self, round):
"""Print all the component's evaluated data to the terminal."""
diff --git a/example_airfoil.py b/example_airfoil.py
index 0709734..e5e586d 100644
--- a/example_airfoil.py
+++ b/example_airfoil.py
@@ -42,9 +42,9 @@ NOSE_BOTTOM_STRINGERS = 5
SAVE_PATH = '/home/blendux/Projects/Aircraft_Studio/save'
-eval = evaluator.Evaluator
+eval = evaluator.Evaluator()
# Create aircraft instance
-ac = creator.base.Aircraft(eval)
+ac = creator.base.Aircraft(eval, "ac")
# Create airfoil instance
af = creator.wing.Airfoil(ac, 'af')
af.add_naca(NACA_NUM)
@@ -59,6 +59,9 @@ af.spar2 = creator.wing.Spar(af, 'spar2', 0.57)
af.spar1.info_save()
af.spar2.info_save()
+eval.update()
+# eval.info_print(2)
+
# # Create stringer instance
# af.stringer = wing.Stringer()
# # Compute the stringer coordinates from their quantity in each zone
Copyright 2019--2024 Marius PETER