Make RPM Graph

This commit is contained in:
Cal Wing 2024-08-26 15:16:41 +10:00
parent d670bcf26a
commit 66c4d7d23a

37
main.py
View File

@ -89,7 +89,38 @@ def make_pressure_graph(sheet1, aoa, rpm, air_speed, doGraph=True):
return pressure, graph, (water_density, air_density, atm_presure_inch, pitot_height_inch) return pressure, graph, (water_density, air_density, atm_presure_inch, pitot_height_inch)
def make_rpm_grpah():
air_density = data_508rpm["data"]["0 AoA"].iloc[1, 2] # kg/m^3
rpm = np.concat((np.array([0]), np.array(data_508rpm["data"]["0 AoA"].iloc[4:14, 2])))
pressure = np.concat((np.array([0]), np.array(data_508rpm["data"]["0 AoA"].iloc[4:14, 4], dtype=np.float64)))
airSpeed = sqrt(-pressure * 2 / air_density)
x = np.linspace(rpm[0], rpm[-1], 1000)
y = 0.0212*x - 0.7751
graph = {
"title": f"RPM vs Velocity for Wind Tunnel 3",
"xLabel": "Fan RPM",
"yLabel": "Airspeed [m/s]",
"grid": True,
"plots": [
{"x": x, "y":y, "label":"Linear Estimate", "args":{"linestyle":"--"}, "colour": UQC["neutral"]},
{"type": "scatter", "x":rpm, "y": airSpeed, "label": "Measured Velocity", "colour":UQC["purple"], "args":{"zorder":2}},
{"type": "point", "x":508, "y": 10, "label": "Selected RPM (508)", "colour":UQC["red"], "zorder":3},
{"type":"text", "x": 0.98, "y": 0.02, "text": f"Velocity at 508 RPM: {10:.3f} m/s\nVelocity at 1000 RPM: {airSpeed[-1]:.3f} m/s", "align": ('bottom', 'right')},
{"type":"text", "x": 0.80, "y": 0.85, "text": f"$y = 0.0212 \\cdot x - 0.7751$", "align": ('bottom', 'right'), "facecolour": UQC["neutral"]}
]
}
makeGraph(graph, False, figSavePath='./images/{0}.png')
if __name__ == '__main__': if __name__ == '__main__':
print("Generating RPM Graph")
make_rpm_grpah()
print("Loading Data & Generating Pressure Graphs") print("Loading Data & Generating Pressure Graphs")
data = {} data = {}
for raw_data in tqdm((data_508rpm, data_1000rpm), position=0): for raw_data in tqdm((data_508rpm, data_1000rpm), position=0):
@ -97,11 +128,11 @@ if __name__ == '__main__':
for aoa in tqdm(raw_data["AoA"], position=1): for aoa in tqdm(raw_data["AoA"], position=1):
sheet = raw_data["data"][f"{aoa} AoA"] sheet = raw_data["data"][f"{aoa} AoA"]
aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], True) aoa_data[aoa] = make_pressure_graph(sheet, aoa, raw_data["rpm"], raw_data["airSpeed"], False)
data[raw_data["rpm"]] = aoa_data data[raw_data["rpm"]] = aoa_data
if True: if False:
# All # All
graph = { graph = {
"title": f"Pressure vs Pitot Placement along Chord\nfor a Clark Y 14% Aerofoil at:\n{raw_data["rpm"]:d} RPM ({raw_data["airSpeed"]:.1f}m/s)", "title": f"Pressure vs Pitot Placement along Chord\nfor a Clark Y 14% Aerofoil at:\n{raw_data["rpm"]:d} RPM ({raw_data["airSpeed"]:.1f}m/s)",
@ -160,4 +191,6 @@ if __name__ == '__main__':