summaryrefslogtreecommitdiff
path: root/evaluator.py
diff options
context:
space:
mode:
Diffstat (limited to 'evaluator.py')
-rw-r--r--evaluator.py75
1 files changed, 34 insertions, 41 deletions
diff --git a/evaluator.py b/evaluator.py
index 0307079..2adc702 100644
--- a/evaluator.py
+++ b/evaluator.py
@@ -29,33 +29,38 @@ class Evaluator:
self.I_ = {'x': 0, 'z': 0, 'xz': 0}
def _get_lift_rectangular(aircraft, lift=50):
- L_prime = [
+ L_prime = np.array([
lift / (aircraft.wing.semi_span * 2)
for _ in range(aircraft.wing.semi_span)
- ]
+ ])
return L_prime
def _get_lift_elliptical(aircraft, L_0=3.2):
- L_prime = [
- L_0 / (aircraft.wing.semi_span * 2) *
+ L_prime = np.array([
+ 0.5 * L_0 / (aircraft.wing.semi_span * 2) *
sqrt(1 - (y / aircraft.wing.semi_span)**2)
for y in range(aircraft.wing.semi_span)
- ]
+ ])
return L_prime
def get_lift_total(self, aircraft):
"""Combination of rectangular and elliptical lift."""
- F_z = [
- self._get_lift_rectangular(aircraft) +
- self._get_lift_elliptical(aircraft) / 2
- for i in range(aircraft.wing.semi_span)
- ]
- return F_z
+ # F_z = self._get_lift_rectangular(aircraft) + self._get_lift_elliptical(
+ # aircraft)
+ # F_z = self._get_lift_rectangular(
+ # aircraft) + self._get_lift_elliptical(aircraft) / 2
+ # F_z = [i + j for i, j in self._get_lift_rectangular]
+ # return F_z
+ return 420
def get_mass_distribution(self, total_mass):
F_z = [total_mass / self.semi_span for x in range(0, self.semi_span)]
return F_z
+ def get_mass_total(self, aircraft):
+ """Get the total aircraft mass."""
+ return 2000
+
def get_drag(aircraft, drag):
# Transform semi-span integer into list
semi_span = [x for x in range(0, aircraft.wing.semi_span)]
@@ -68,6 +73,10 @@ class Evaluator:
F_x.extend([1.25 * drag for x in semi_span[cutoff:]])
return F_x
+ def get_drag_total(self, aircraft):
+ """Get total drag force acting on the aircraft."""
+ return 500
+
def get_centroid(aircraft):
"""Return the coordinates of the centroid."""
stringer_area = aircraft.stringer.area
@@ -151,36 +160,20 @@ class Evaluator:
area * zDist[_] * (I_z * V_z - I_xz * V_x) / denom)
return z
- def analysis(self):
- """Perform all analysis calculations and store in self.results."""
- # with concurrent.futures.ProcessPoolExecutor() as executor:
- # for aircraft in self.aircrafts:
- # lift = executor.submit(self.get_lift_total(aircraft))
- # drag = executor.submit(self.get_drag_total(aircraft))
- # mass = executor.submit(self.get_mass_total(aircraft))
- # thrust = executor.submit(self.get_thrust_total(aircraft))
-
- # for aircraft in self.aircrafts:
- # print(lift.result())
- # print(drag.result())
- # print(mass.result())
- # print(thrust.result())
-
- # for f in concurrent.futures.as_completed(l, d, m, t):
- # print(f.result())
-
- for aircraft in self.aircrafts:
- # lift = self.get_lift_total(aircraft),
- # drag = self.get_drag(aircraft.wing),
- # centroid = self.get_centroid(aircraft.wing)
- results = {"Lift": 400, "Drag": 20, "Centroid": [0.2, 4.5]}
- self.results.append(results)
- # results = {
- # "Lift": self.get_lift_total(aircraft),
- # "Drag": self.get_drag(aircraft),
- # "Centroid": self.get_centroid(aircraft)
- # }
- return results
+ def analyze(self, aircraft):
+ """Analyze a single aircraft."""
+ aircraft.results = {}
+ aircraft.results.update({'Lift': self.get_lift_total(aircraft)})
+ aircraft.results.update({'Drag': self.get_drag_total(aircraft)})
+ aircraft.results.update({'Mass': self.get_mass_total(aircraft)})
+ print(aircraft.results)
+ return None
+
+ def analyze_all(self):
+ """Perform all analysis calculations on a all aircraft in evaluator."""
+ with concurrent.futures.ProcessPoolExecutor() as executor:
+ executor.map(self.analyze, self.aircrafts)
+ return None
# def analysis(self, V_x, V_z):
# """Perform all analysis calculations and store in class instance."""
Copyright 2019--2024 Marius PETER