From 66c4d7d23ad5eee504fb4d5c3b05e9c55ffdcb2f Mon Sep 17 00:00:00 2001 From: Cal Wing <20716204+calw20@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:16:41 +1000 Subject: [PATCH] Make RPM Graph --- main.py | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 758a135..cc0810d 100644 --- a/main.py +++ b/main.py @@ -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) +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__': + print("Generating RPM Graph") + make_rpm_grpah() + print("Loading Data & Generating Pressure Graphs") data = {} 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): 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 - if True: + if False: # All 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)", @@ -160,4 +191,6 @@ if __name__ == '__main__': + +