Final changes to code, sorry it's messy lol

This commit is contained in:
William Johnstone 2024-11-27 21:42:29 +00:00
parent 28ba83d783
commit db478991e1
Signed by: williamjohnstone
GPG key ID: 89703D0D4B3BB0FE
4 changed files with 138 additions and 2 deletions

View file

@ -1,3 +1,6 @@
# William Johnstone
# Apologies to anyone reading this, it became a mess. I wanted to tidy it but we don't always get what we want.
import matplotlib.pyplot as plt
import math
@ -146,4 +149,83 @@ print(f"Second moment of inertia for new test: {area_moment_inertia} m^4")
max_stress = bending_moment_wing * ((D/2) / area_moment_inertia)
print(f"Max Stress for new test spar: {max_stress:.4f} Pa or {max_stress/1000000:.4f} MPa")
# Aerofoil Spars
B = 18 * 0.001 # Width in m
D = 3.5 * 0.001 # Height or depth in m
# 6mm Spars
area_moment_inertia = ((B) * (D**3))/12
print(f"Second moment of inertia for 6x3mm: {area_moment_inertia} m^4")
max_stress = bending_moment_wing * ((D/2) / area_moment_inertia)
print(f"Max Stress for 6x3mm: {max_stress:.4f} Pa or {max_stress/1000000:.4f} MPa")
B = 6 * 0.001 # Width in m
D = 0.5 * 0.001 # Height or depth in m
# 6mm Spars
area_moment_inertia = ((B) * (D**3))/12
print(f"Second moment of inertia for 6x3.5mm: {area_moment_inertia} m^4")
max_stress = bending_moment_wing * ((D/2) / area_moment_inertia)
print(f"Max Stress for 6x3.5mm: {max_stress:.4f} Pa or {max_stress/1000000:.4f} MPa")
# Bending Moment for tail (Rohan's numbers )
bending_moment_wing = (lift_force_total / number_of_wings) * (wing_span_metric / 4)
print(f"Bending Moment at of 1 Wing from root: {bending_moment_wing:.4f} Nm\n")
######################################################################
# 27/11/24
# Updated stress calcs with new weight (from detailed CAD model, including payload mass)
print("#############################################################")
print("Everything after this is based on numbers from final CAD model. Thus more relevant")
print("Weight (Final, from CAD Model) (mass): %0.4f kg" % (262*(10**-3)))
# Total Lift Force
lift_force_total = (262*(10**-3)) * 9.81
#lift_force_per_ft = lift_force_total / wing_span
#lift_force_per_wing_per_ft = lift_force_per_ft / 2
print("Total Lift Force: {:.4f} N\n".format(lift_force_total))
# Bending Moments
number_of_wings = 2
print("BENDING MOMENTS (LATEST, THESE ARE THE ONLY ONES RELEVANT)\n")
wing_span_metric = wing_span * 0.3048
print("Wing Span: {:.4f} m".format(wing_span_metric))
# Bending Moment at Wing Root
bending_moment_wing = (lift_force_total / number_of_wings) * (wing_span_metric / 4)
print(f"Bending Moment at of 1 Wing from root: {bending_moment_wing:.4f} Nm\n")
# Max bending stress for Balsa (https://woodworkly.com/is-balsa-wood-strong/)
bending_strength_psi_lower = 2550
bending_strength_psi_upper = 3170
bending_strength_megapascal_lower = bending_strength_psi_lower * 0.006894757 # (1 psi = 0.006894757 MPa)
bending_strength_megapascal_upper = bending_strength_psi_upper * 0.006894757 # (1 psi = 0.006894757 MPa)
# Max Stress Calcs
B = 18 * 0.001 # Width in m
D = 2.5 * 0.001 # Height or depth in m
# 4mm Spars
area_moment_inertia = ((B) * (D**3))/12
print(f"Second moment of inertia for final model: {area_moment_inertia} m^4")
max_stress = bending_moment_wing * ((D/2) / area_moment_inertia)
max_stress_megapascal = max_stress/1000000
print(f"Max Stress for final model spar: {max_stress:.4f} Pa or {max_stress_megapascal:.4f} MPa")
print(f"Balsa Wood Bending Stress Upper Limit: {bending_strength_megapascal_upper:.4f}MPa, Lower Limit: {bending_strength_megapascal_lower:.4f} MPa")
print(f"Safety Factor: {bending_strength_megapascal_lower/max_stress_megapascal:.1f} - {bending_strength_megapascal_upper/max_stress_megapascal:.1f}")