diff options
author | Marius Peter <blendoit@gmail.com> | 2019-06-20 21:05:57 -0700 |
---|---|---|
committer | Marius Peter <blendoit@gmail.com> | 2019-06-20 21:05:57 -0700 |
commit | 7fdc7e586e1c2125eef533af77dcb5ee8930b702 (patch) | |
tree | c63a5e447042bbc87603b6c3582b6b9776357e00 | |
parent | 86a92de95e6894a2b6e23889214e943fdf211cdf (diff) |
consistent 'get' inputs and outputs in evaluator
-rw-r--r-- | creator.py | 1 | ||||
-rw-r--r-- | evaluator.py | 17 | ||||
-rw-r--r-- | main.py | 14 |
3 files changed, 21 insertions, 11 deletions
@@ -360,7 +360,6 @@ class Stringer(Coordinates): def plot(airfoil, spar, stringer): """This function plots the elements passed as arguments.""" - print('Plotting airfoil.') # Plot chord x_chord = [0, airfoil.chord] y_chord = [0, 0] diff --git a/evaluator.py b/evaluator.py index a734c78..2b61348 100644 --- a/evaluator.py +++ b/evaluator.py @@ -15,8 +15,6 @@ from math import sin, cos, atan, sqrt -# All of these functions take integer arguments and return lists. - def get_total_mass(*component): total_mass = float() @@ -25,18 +23,23 @@ def get_total_mass(*component): return total_mass -def get_lift_rectangular(lift, semi_span): - L_prime = lift / (semi_span * 2) +# All these functions take integer arguments and return lists. + +def get_lift_rectangular(airfoil, lift): + L_prime = [lift / (airfoil.semi_span * 2) + for x in range(airfoil.semi_span)] return L_prime -def get_lift_elliptical(L_0, y, semi_span): - L_prime = L_0 * sqrt(1 - (y / semi_span) ** 2) +def get_lift_elliptical(airfoil, L_0): + L_prime = [L_0 * sqrt(1 - (y / airfoil.semi_span) ** 2) + for y in range(airfoil.semi_span)] return L_prime def get_lift(rectangular, elliptical): - F_z = (rectangular + elliptical) / 2 + F_z = [(rectangular[_] + elliptical[_]) / 2 + for _ in range(len(rectangular))] return F_z @@ -78,13 +78,21 @@ def main(): # print(evaluator.get_total_mass(af, af.spar, af.stringer)) drag = evaluator.get_drag(af, 10) + + lift_rectangular = evaluator.get_lift_rectangular(af, 10) + lift_elliptical = evaluator.get_lift_elliptical(af, 15) + lift = evaluator.get_lift(lift_rectangular, lift_elliptical) + total_mass = evaluator.get_total_mass(af, af.spar, af.stringer) dist_mass = evaluator.get_mass_distribution(af, total_mass) - print(total_mass) - print(dist_mass) + print('rect', len(lift_rectangular)) + print('ellipse', len(lift_elliptical)) + print('lift', len(lift)) + print(len(drag)) + print(len(dist_mass)) # Plot components with matplotlib - creator.plot(af, af.spar, af.stringer) + # creator.plot(af, af.spar, af.stringer) # Save component info # af.save_info(SAVE_PATH, _) |