diff options
author | blendoit <blendoit@gmail.com> | 2019-10-17 22:24:21 -0700 |
---|---|---|
committer | blendoit <blendoit@gmail.com> | 2019-10-17 22:24:21 -0700 |
commit | 97a837f74c7ca5c53bae48364398b09d15b1509e (patch) | |
tree | 90fe60d8589b8514ce06d2d2b6a29449bd8399f0 /evaluator/evaluator.py | |
parent | aa4fd65dd462b2e177a012bce06ebfc5cdfc48cd (diff) |
refactor stringer generating function
Diffstat (limited to 'evaluator/evaluator.py')
-rw-r--r-- | evaluator/evaluator.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/evaluator/evaluator.py b/evaluator/evaluator.py index a668854..53fab3b 100644 --- a/evaluator/evaluator.py +++ b/evaluator/evaluator.py @@ -10,6 +10,7 @@ import os.path import numpy as np from math import sqrt import matplotlib.pyplot as plt +import concurrent.futures import logging logging.basicConfig(filename='log_eval.txt', @@ -28,24 +29,26 @@ class Evaluator: self.I_ = {'x': 0, 'z': 0, 'xz': 0} def get_lift_rectangular(aircraft, lift=50): - # L_prime = [ - # lift / (aircraft.wing.semi_span * 2) - # for x in range(aircraft.wing.semi_span) - # ] - return lift + L_prime = [ + lift / (aircraft.wing.semi_span * 2) + for x 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) * - # sqrt(1 - (y / aircraft.wing.semi_span)**2) - # for y in range(aircraft.wing.semi_span) - # ] - return L_0 + L_prime = [ + 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): - F_z = 100 - # F_z = [(self.get_lift_rectangular() + self.get_lift_elliptical() / 2 - # for _ in range(len(aircraft.lift_rectangular))] + F_z = [ + self.get_lift_rectangular(aircraft) + + self.get_lift_elliptical(aircraft) / 2 + for _ in range(aircraft.wing.semi_span) + ] return F_z def get_mass_distribution(self, total_mass): @@ -149,6 +152,9 @@ class Evaluator: def analysis(self): """Perform all analysis calculations and store in self.results.""" + with concurrent.futures.ProcessPoolExecutor() as executor: + f1 = executor.submit(self.get_lift_total) + for aircraft in self.aircrafts: # lift = self.get_lift_total(aircraft), # drag = self.get_drag(aircraft.wing), @@ -213,6 +219,7 @@ class Evaluator: print(".") print(f"`-- {aircraft}") print(f" |--{aircraft.wing}") + print(f" | |-- {aircraft.wing.stringers}") for spar in aircraft.wing.spars[:-1]: print(f" | |-- {spar}") print(f" | `-- {aircraft.wing.spars[-1]}") |