![]() index = int(np.where(time=burnTime) + 1) thrust = np.append(np.repeat(averageThrust, index), np.repeat(0, len(time) - index)) Because this is a graph, we can easily find the area under the graph using the trapezium method. The area under the curve needs to be found out if we are going to find the velocity from acceleration. To get displacement we need velocity, for which we need acceleration. It’s time to remember some basic physics. You can lookup the numpy documentation to learn more about linspace. “linspace” will give an array of numbers from 0 to 9.9. import numpy as np time = np.linspace(0, 10, 100, False) However, if you want you can increase the accuracy. Because the burn time is to 1 decimal place, our time stamps must be to that d.p. Now I am going to make a time array that will have the different time stamps we will require. averageThrust = totalImpulse/burnTime massFlowRate = propellantMass/burnTime However, this code will work even if you decide to add how those variables change with time. Due to simplicity, I am assuming that both of them are constant. Next I am going to calculate things like the mass flow rate, the rate at which the motor uses propellant, and the average thrust. totalMass = 1 dryMass = 0.906 burnTime = 3.4 totalImpulse = 49.6 propellantMass = 0.064 I am going to make variables of the required properties of the motor. Also I decided to use the Estes F15 motor because I think it is optimum for this simulation. I just randomly picked this value but if you have an actual rocket you must weigh things. I am considering the total mass with the motor (wet mass) to be 1 kg. Let us start off by choosing some values. I am using Python 3.7.3 but you can use any version which supports matplotlib and numpy. ![]() Also through out the code we will be using the SI units. This is because I did not want to make things really complex by adding drag into the equations. This code is only meant for rockets that go below 1 kilometres in the air. I am currently working on a full scale library for flight simulations and I thought I’ll share this piece of code with everyone. One such thing is making flight path simulations. Model rocketry is an awesome hobby and as a space enthusiast I constantly try to do things related to it. ![]()
0 Comments
Leave a Reply. |