summaryrefslogtreecommitdiff
path: root/example_airfoil.py
diff options
context:
space:
mode:
Diffstat (limited to 'example_airfoil.py')
-rw-r--r--example_airfoil.py82
1 files changed, 82 insertions, 0 deletions
diff --git a/example_airfoil.py b/example_airfoil.py
new file mode 100644
index 0000000..292c1e9
--- /dev/null
+++ b/example_airfoil.py
@@ -0,0 +1,82 @@
+"""This example illustrates the usage of creator, evaluator and generator.
+
+All the steps of airfoil creation & evaluation are detailed here;
+furthermore, the generator.py module contains certain presets
+(default airfoils).
+
+Create an airfoil;
+Evaluate an airfoil;
+Generate a population of airfoils & optimize.
+"""
+
+from resources import materials as mt
+from creator import wing, fuselage, propulsion
+# from evaluator import
+# from generator import
+
+import time
+start_time = time.time()
+
+# Airfoil dimensions (in)
+NACA_NUM = 2412
+
+# Thicknesses
+SPAR_THICKNESS = 0.4
+SKIN_THICKNESS = 0.1
+
+# Component masses (lbs)
+AIRFOIL_MASS = 10
+SPAR_MASS = 10
+STRINGER_MASS = 5
+
+# Area (sqin)
+SPAR_CAP_AREA = 0.3
+STRINGER_AREA = 0.1
+
+# Amount of stringers
+TOP_STRINGERS = 6
+BOTTOM_STRINGERS = 4
+NOSE_TOP_STRINGERS = 3
+NOSE_BOTTOM_STRINGERS = 5
+
+SAVE_PATH = '/home/blendux/Projects/Aircraft_Studio/save'
+
+# Create airfoil instance
+af = wing.Airfoil(68, 150, mt.aluminium)
+af.add_naca(NACA_NUM)
+# af.info_print(2)
+af.info_save(SAVE_PATH, 'foo_name')
+
+# Create spar instances
+af.spar1 = wing.Spar(af, 0.23, mt.aluminium)
+af.spar2 = wing.Spar(af, 0.57, mt.aluminium)
+# af.spar1.info_print(2)
+# af.spar2.info_print(2)
+af.spar1.info_save(SAVE_PATH, 'spar1')
+af.spar2.info_save(SAVE_PATH, 'spar2')
+
+# # Create stringer instance
+# af.stringer = wing.Stringer()
+# # Compute the stringer coordinates from their quantity in each zone
+# af.stringer.add_coord(af, [af.spar1, af.spar2], NOSE_TOP_STRINGERS, TOP_STRINGERS,
+# NOSE_BOTTOM_STRINGERS, BOTTOM_STRINGERS)
+# af.stringer.add_area(STRINGER_AREA)
+# af.stringer.add_webs(SKIN_THICKNESS)
+# af.stringer.info_print(2)
+# af.stringer.info_save(SAVE_PATH, 'foo_name')
+
+# Plot components with matplotlib
+wing.plot_geom(af, [af.spar1, af.spar2], None)
+
+# Evaluator object contains airfoil analysis results.
+# eval = evaluator.Evaluator(af)
+# The analysis is performed in the evaluator.py module.
+# eval.analysis(1, 1)
+# eval.info_print(2)
+# eval.info_save(SAVE_PATH, 'foo_name')
+# evaluator.plot_geom(eval)
+# evaluator.plot_lift(eval)
+
+# Final execution time
+final_time = time.time() - start_time
+print(f"--- {round(final_time, 4)}s seconds ---")
Copyright 2019--2024 Marius PETER