summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorblendoit <blendoit@gmail.com>2019-10-21 21:25:52 -0700
committerblendoit <blendoit@gmail.com>2019-10-21 21:25:52 -0700
commit5ab73817371c1b4fedbd98838d3cf28984d73004 (patch)
treedb564394fa4db6db703738c469790d63d09e945b /example.py
parent5e82dedea4c56eafc1bba4f3ec8677b15f51c03f (diff)
Correct implem. of evaluator.analyze_all & Evaluator declassification
Diffstat (limited to 'example.py')
-rw-r--r--example.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/example.py b/example.py
new file mode 100644
index 0000000..5faaae3
--- /dev/null
+++ b/example.py
@@ -0,0 +1,72 @@
+"""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.
+"""
+
+import matplotlib.pyplot as plt
+
+import creator
+import evaluator
+import generator
+import resources.materials as mt
+
+import time
+start_time = time.time()
+
+# 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
+
+SAVE_PATH = '/home/blendux/Projects/Aircraft_Studio/save'
+
+# eval = evaluator.Evaluator("eval")
+
+# ac = creator.base.Aircraft(eval, "ac")
+# af = creator.wing.Airfoil(ac, 'af')
+# af.add_naca(2412)
+# spar1 = creator.wing.Spar(af, 'spar1')
+# spar2 = creator.wing.Spar(af, 'spar2', 0.57)
+# # spar2 = creator.wing.Spar(af, 'spar2', 0.7)
+# stringer = creator.wing.Stringer(af, 'stringer', 5, 6, 5, 4)
+# stringer.info_save(SAVE_PATH)
+
+# ac2 = creator.base.Aircraft(eval, "ac2")
+# af2 = creator.wing.Airfoil(ac2, 'af2')
+# af2.add_naca(3412)
+# af2.info_save()
+# spar3 = creator.wing.Spar(af2, 'spar3', 0.23)
+# spar4 = creator.wing.Spar(af2, 'spar4', 0.67)
+# stringer2 = creator.wing.Stringer(af2, 'stringer2')
+# stringer2.info_save(SAVE_PATH)
+
+pop = generator.Population(200)
+
+evaluator.analyze_all(pop)
+
+# for aircraft in pop.aircrafts:
+# print(aircraft.results)
+
+# for i in eval.aircrafts:
+# print(i.name)
+
+# for i in eval.aircrafts:
+# print(i.results)
+
+# Final execution time
+final_time = time.time() - start_time
+print(f"--- {round(final_time, 4)}s seconds ---")
Copyright 2019--2024 Marius PETER