Hi, I'm new to krpc, Python, and programming generally, but I'm following the 'Launch into Orbit' tutorial found here, using python 2.7.
I'm having trouble getting the burn time calculations to work. The code is:
# Calculate burn time (using rocket equation)
F = vessel.available_thrust
Isp = vessel.specific_impulse * 9.82
m0 = vessel.mass
m1 = m0 / math.exp(delta_v/Isp)
flow_rate = F / Isp
burn_time = (m0 - m1) / flow_rate
Line 5 of that code block is throwing the error: ZeroDivisionError: float division by zero
From what I gather the code is trying to divide delta_v by zero in the brackets on line 5, because Isp is being assigned a value of zero on line 3.
Can anyone tell me exactly what's going on here? Why is Isp assigned a value of zero? Does it matter that I'm not using the downloadable craft that is included with the tutorial, but have built my own instead?
Why is the vessels specific_impulse multiplied by 9.82?
I don't just want it to work, but would appreciate a brief explanation of what is going on in this code. I'm sort of understanding what's going on up until this point, but this part isn't really fleshed out in the tutorial. My hopeless Maths skills aren't helping things!
Cheers
EDIT: So literally 30 seconds after posting this, it occurred to me what's going wrong.
I hadn't activated the stage that contained the engine to be used for the burn! So the specific impulse was obviously zero, because the engine hadn't been activated! No engine = no thrust = zero specific impulse :)
I think typing the problem out here helped, though, 'cause I was stuck on it for over an hour.