Fix duncing with trap grahps

This commit is contained in:
Cal Wing 2024-08-28 11:58:28 +10:00
parent 89ce01b02a
commit 5765f08e5e
2 changed files with 15 additions and 13 deletions

4
.gitignore vendored
View File

@ -162,8 +162,10 @@ cython_debug/
# Image Folder
images
images-*
# Temp Folder
tmp
tmp/
tmp-*
data/~$*

24
main.py
View File

@ -116,14 +116,14 @@ def make_cp_graph(pressure, aoa, rpm, air_speed, data, doGraph=True):
# Do the trapiztoal rule integration
da = []
for i, _ in enumerate(pressure):
if not i: continue # Skip 0
if i in [0, 10]: continue # Skip 0 & Tapping 11 (Don't want to calc taping[11] - tapp[10])
da.append(((pressure.iloc[i-1] + pressure.iloc[i])/2) * (PITOT_PLACEMENT_CHORD_NORM[i]-PITOT_PLACEMENT_CHORD_NORM[i-1]))
da = np.array(da)
force = da.sum()
lift = force * sin(aoa)
drag = force * cos(aoa)
lift = force * cos(aoa)
drag = force * sin(aoa)
# Extrapolate Aerofoil Tip
p1 = (PITOT_PLACEMENT_CHORD_NORM[9], cp.iloc[9])
@ -210,7 +210,7 @@ if __name__ == '__main__':
for aoa in tqdm(raw_data["AoA"], position=1):
sheet = raw_data["data"][f"{aoa} AoA"]
aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], False)
aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], True)
data[raw_data["rpm"]] = aoa_data
@ -305,12 +305,12 @@ if __name__ == '__main__':
for aoa in tqdm(raw_data["AoA"], position=1):
this_data = data[raw_data["rpm"]][aoa]
cp_data_this = make_cp_graph(this_data[0], aoa, raw_data["rpm"], raw_data["airSpeed"], this_data[2], False)
cp_data_this = make_cp_graph(this_data[0], aoa, raw_data["rpm"], raw_data["airSpeed"], this_data[2], True)
cp_pain_data.append(cp_data_this)
cp_data[raw_data["rpm"]] = cp_pain_data
if False:
if True:
# All
graph = {
"title": f"All $C_p$ vs Pitot Placement along Chord\nfor a Clark Y 14% Aerofoil at:\n{raw_data["rpm"]:d}rpm - {raw_data["airSpeed"]:.1f}m/s)",
@ -353,7 +353,7 @@ if __name__ == '__main__':
graph["figSize"] = (8, 6)
makeGraph(graph, False, figSavePath="./images/cp/__{0}.png")
makeGraph(graph, False, figSavePath="./images/cp/__{0}.png", closeFig=True)
graph["title"] = f"$C_p$ vs Pitot Placement along Chord\nfor a Clark Y 14% Aerofoil at:\n{raw_data["rpm"]:d}rpm - {raw_data["airSpeed"]:.1f}m/s)"
graph["windowTitle"] = f"Cp along Clark Y 14 Percent Airfoil - {raw_data["rpm"]:d}rpm - {raw_data["airSpeed"]:.1f}m_s"
@ -380,9 +380,9 @@ if __name__ == '__main__':
)
for plt in plts:
graph["plots"].append(plt)
makeGraph(graph, False, figSavePath="./images/cp/__{0}.png")
makeGraph(graph, False, figSavePath="./images/cp/__{0}.png", closeFig=True)
if False:
if True:
aoa = [a[4] for a in cp_pain_data]
forces = [a[1] for a in cp_pain_data]
# Force Graphs
@ -400,7 +400,7 @@ if __name__ == '__main__':
]
}
makeGraph(graph, False, figSavePath="./images/{0}.png")
makeGraph(graph, False, figSavePath="./images/{0}.png", closeFig=True)
aoa = [a[4] for a in cp_pain_data][1::2]
forces = [a[1] for a in cp_pain_data][1::2]
@ -419,9 +419,9 @@ if __name__ == '__main__':
]
}
makeGraph(graph, False, figSavePath="./images/{0}.png")
makeGraph(graph, False, figSavePath="./images/{0}.png", closeFig=True)
if False:
if True:
print("\n\n")
print(raw_data["rpm"])
for aoa, force in [(a[4], a[1]) for a in cp_pain_data]: