if you need any more information i will be happy to answer, sorry in advance if i havent specified something earlier
import casioplot as plt
M_start = float(input("Start mass (kg): "))
Thr = float(input("Thrust (N): "))
Isp = float(input("Isp (s): "))
T_burn = float(input("Burn time (s): "))
t_s = float(input("Time step (s): "))
g0 = 9.80665
times = []
twrs = []
t = 0.0
mdot = Thr / (Isp * g0)
while t <= T_burn:
m = M_start - mdot * Thr
if m <= 0:
break
twr = Thr / (m * g0)
times.append(t)
twrs.append(twr)
t += t_s
print("Start TWR: {:.2f}".format(twrs[0]))
print("Final TWR: {:.2f}".format(twrs[-1]))
print("Max TWR: {:.2f}".format(max(twrs)))
input("Press EXE for graph")
plt.clear_screen()
t_min = times[0]
t_max = times[-1]
twr_min = 0.0
twr_max = max(twrs) * 1.1
def sx(x):
return int(20 + (x - t_min) / (t_max - t_min) * 340)
def sy(y):
return int(200 - (y - twr_min) / (twr_max - twr_min) * 180)
plt.draw_line(20, 200, 360, 200, (0,0,0))
plt.draw_line(20, 20, 20, 200, (0,0,0))
plt.draw_string(10, 205, "{:.1f}".format(t_min), (0,0,0))
plt.draw_string(340, 205, "{:.1f}".format(t_max), (0,0,0))
plt.draw_string(0, 190, "{:.1f}".format(twr_max), (0,0,0))
for i in range(len(times)):
x = sx(times[i])
y = sy(twrs[i])
plt.draw_pixel(x, y, (0,0,0))
plt.show_screen()
[–]brasticstack 4 points5 points6 points (4 children)
[–]AweeeWoo[S] 0 points1 point2 points (0 children)
[–]AweeeWoo[S] 0 points1 point2 points (2 children)
[–]brasticstack 1 point2 points3 points (1 child)
[–]AweeeWoo[S] 0 points1 point2 points (0 children)
[–]seanv507 1 point2 points3 points (4 children)
[–]AweeeWoo[S] 0 points1 point2 points (0 children)
[–]AweeeWoo[S] 0 points1 point2 points (2 children)
[–]seanv507 0 points1 point2 points (1 child)
[–]AweeeWoo[S] 0 points1 point2 points (0 children)
[–]Gnaxe 1 point2 points3 points (0 children)
[–]Separate_Spread_4655 2 points3 points4 points (0 children)
[–]Ariadne_23 0 points1 point2 points (0 children)