39 lines
No EOL
1.4 KiB
Python
39 lines
No EOL
1.4 KiB
Python
import matplotlib.pyplot as plt
|
|
|
|
def raymers_iterate(current_max_weight, payload_weight, fuel_weight, a_constant, c_constant, variable_sweep_constant):
|
|
empty_max_weight_ratio = (a_constant * current_max_weight**c_constant * variable_sweep_constant)
|
|
|
|
new_max_weight = payload_weight / (1 - (fuel_weight / current_max_weight) - (empty_max_weight_ratio))
|
|
return new_max_weight
|
|
|
|
payload_mass_metric = 125 # Grams
|
|
payload_mass_imperial = payload_mass_metric * 0.002204623 # Converting grams to pounds
|
|
|
|
a_constant = 0.86 # Sailplane - Unpowered
|
|
c_constant = -0.05 # Sailplane - Unpowered
|
|
|
|
max_weight_guess = 6 # Initial weight guess of 6 lbs
|
|
current_estimate = max_weight_guess
|
|
|
|
imperial_estimates = []
|
|
|
|
for i in range(0,11):
|
|
current_estimate = raymers_iterate(current_estimate, payload_mass_imperial, 0, a_constant, c_constant, 1)
|
|
imperial_estimates.append(current_estimate)
|
|
|
|
metric_estimates = []
|
|
|
|
for imperial_estimate in imperial_estimates:
|
|
metric_estimates.append(imperial_estimate / 0.002204623)
|
|
|
|
plt.plot(metric_estimates, linestyle='--', marker='o')
|
|
|
|
# Add labels to each point
|
|
for index, weight in enumerate(metric_estimates):
|
|
plt.text(index, weight + 5, f'{index}: {weight:.2f}', fontsize=9, ha='right')
|
|
|
|
plt.title("Aircraft Raymer's Method Weight Estimation")
|
|
plt.xlabel("Iteration Number")
|
|
plt.ylabel("Weight Estimation (g)")
|
|
plt.grid(True)
|
|
plt.show() |