Fix force generation
This commit is contained in:
parent
a3a4a14924
commit
a794c47d1a
39
main.py
39
main.py
@ -25,7 +25,7 @@ for folder in folders:
|
|||||||
INCH_TO_M = 0.0254
|
INCH_TO_M = 0.0254
|
||||||
GRAVITY = 9.81 #m/s^2
|
GRAVITY = 9.81 #m/s^2
|
||||||
|
|
||||||
CHORD_LEN = 90 #mm
|
CHORD_LEN = 1000 #90 #mm
|
||||||
PITOT_PLACEMENT = np.array((0,4,8,16,25,34,43,52,61,70,5,9,17,25,34,43,52,61,70)) # mm from base of chord
|
PITOT_PLACEMENT = np.array((0,4,8,16,25,34,43,52,61,70,5,9,17,25,34,43,52,61,70)) # mm from base of chord
|
||||||
PITOT_PLACEMENT_CHORD_NORM = PITOT_PLACEMENT / CHORD_LEN
|
PITOT_PLACEMENT_CHORD_NORM = PITOT_PLACEMENT / CHORD_LEN
|
||||||
|
|
||||||
@ -116,19 +116,37 @@ def make_cp_graph(pressure, aoa, rpm, air_speed, data, doGraph=True):
|
|||||||
# Do the trapiztoal rule integration
|
# Do the trapiztoal rule integration
|
||||||
da = []
|
da = []
|
||||||
for i, _ in enumerate(pressure):
|
for i, _ in enumerate(pressure):
|
||||||
if i in [0, 10]: continue # Skip 0 & Tapping 11 (Don't want to calc taping[11] - tapp[10])
|
if i in [0]: continue # Skip 0
|
||||||
da.append(((pressure.iloc[i-1] + pressure.iloc[i])/2) * (PITOT_PLACEMENT_CHORD_NORM[i]-PITOT_PLACEMENT_CHORD_NORM[i-1]))
|
if i in [10]: # Force tapping 11 to use tapping 1 rather then 0
|
||||||
|
da.append(((PITOT_PLACEMENT_CHORD_NORM[i] - PITOT_PLACEMENT_CHORD_NORM[0])/2) * (pressure.iloc[0] + pressure.iloc[i]))
|
||||||
|
continue
|
||||||
|
|
||||||
|
da.append(((PITOT_PLACEMENT_CHORD_NORM[i] - PITOT_PLACEMENT_CHORD_NORM[i-1])/2) * (pressure.iloc[i-1] + pressure.iloc[i]))
|
||||||
|
|
||||||
|
|
||||||
da = np.array(da)
|
da = np.array(da)
|
||||||
|
|
||||||
force = da.sum()
|
#print("\n\n\n\n")
|
||||||
|
#print(da)
|
||||||
|
#print("\n\n\n\n")
|
||||||
|
|
||||||
|
upper_force = da[:10].sum()
|
||||||
|
lower_force = da[10 :].sum()
|
||||||
|
|
||||||
|
force = lower_force - upper_force # Upper Sum (1-10) less Lower Sum (11-19)
|
||||||
lift = force * cos(aoa)
|
lift = force * cos(aoa)
|
||||||
drag = force * sin(aoa)
|
drag = force * sin(aoa)
|
||||||
|
|
||||||
|
#print("force, lift, drag, upper_force, lower_force")
|
||||||
|
#print(force, lift, drag, upper_force, lower_force)
|
||||||
|
|
||||||
|
|
||||||
|
#print(f"{aoa}, ")
|
||||||
|
|
||||||
# Extrapolate Aerofoil Tip
|
# Extrapolate Aerofoil Tip
|
||||||
p1 = (PITOT_PLACEMENT_CHORD_NORM[9], cp.iloc[9])
|
p1 = (PITOT_PLACEMENT_CHORD_NORM[9], cp.iloc[9])
|
||||||
p2 = (PITOT_PLACEMENT_CHORD_NORM[18], cp.iloc[18])
|
p2 = (PITOT_PLACEMENT_CHORD_NORM[18], cp.iloc[18])
|
||||||
pN = (0.9, p2[1] + (p1[1]-p2[1])/2)
|
pN = (1.1*max(PITOT_PLACEMENT_CHORD_NORM), p2[1] + (p1[1]-p2[1])/2)
|
||||||
#print(aoa, rpm, p1[1], p2[1], (p1[1]-p2[1])/2, pN[1], pN[1] > p1[1])
|
#print(aoa, rpm, p1[1], p2[1], (p1[1]-p2[1])/2, pN[1], pN[1] > p1[1])
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +185,7 @@ def make_cp_graph(pressure, aoa, rpm, air_speed, data, doGraph=True):
|
|||||||
if doGraph:
|
if doGraph:
|
||||||
makeGraph(graph, False, figSavePath=f'./images/cp/{{0}}.png', closeFig=True)
|
makeGraph(graph, False, figSavePath=f'./images/cp/{{0}}.png', closeFig=True)
|
||||||
|
|
||||||
return cp, (force, lift, drag, da), graph, (p1, p2, pN), aoa
|
return cp, (force, lift, drag, da, upper_force, lower_force), graph, (p1, p2, pN), aoa
|
||||||
|
|
||||||
|
|
||||||
def make_rpm_graph():
|
def make_rpm_graph():
|
||||||
@ -200,7 +218,7 @@ def make_rpm_graph():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("Generating RPM Graph")
|
print("Generating RPM Graph")
|
||||||
make_rpm_graph()
|
#make_rpm_graph()
|
||||||
print("Generated")
|
print("Generated")
|
||||||
|
|
||||||
print("Loading Data & Generating Pressure Graphs")
|
print("Loading Data & Generating Pressure Graphs")
|
||||||
@ -210,11 +228,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)",
|
||||||
@ -424,8 +442,9 @@ if __name__ == '__main__':
|
|||||||
if True:
|
if True:
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
print(raw_data["rpm"])
|
print(raw_data["rpm"])
|
||||||
|
print("AoA Total Lift Drag ---- Upper Force Lower Force ")
|
||||||
for aoa, force in [(a[4], a[1]) for a in cp_pain_data]:
|
for aoa, force in [(a[4], a[1]) for a in cp_pain_data]:
|
||||||
print(f"{aoa:d}\\textdegree & {force[0]:.3f} & {force[1]:.3f} & {force[2]:.3f} \\\\")
|
print(f"{aoa:d}\\textdegree & {force[0]:.3f} & {force[1]:.3f} & {force[2]:.3f} -- {force[4]:.3f} {force[5]:.3f} \\\\")
|
||||||
print("-"*50)
|
print("-"*50)
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user