Rockets

There are lots of programs, including many commercial programs, that will predict the maximum altitude of a model rocket. There are some inexpensive altimeters out there also that can give altitude results when placed inside your model during flight. Are they trustworthy? I wasn't sure so I had an idea to see if I could come up with a LB program that would predict accurately (within 5%) the height of a model rocket.

The main reason for my interest was that I was involved in a rocket altitude contest and as an official, I was concerned that the altimeters were subject to problems. I noticed that every once in a while, a spurious reading would occur. I wanted something that could check the validity of the readings I was getting. It was obvious to me that some readings were just not right. I wanted a program that I could enter rocket mass and motor type and the program would output a reasonable expectation of altitude.

Of course this program is more involved than the others presented on this page so I needed some help. I got a great deal of help from Mr. John Fisher who lives in Merry Old England. Some of you know him as tenochtitlanuk from the Liberty Basic Forums. He had most all of the programs already written and only needed slight modifications to satisfy some of the requirements that I had wanted. I give all credit for these programs to him.

I knew published data was available for model rocket thrust curves. I was not sure how accurate this data was as I was concerned that companies that make the motors might tend to exaggerate the numbers. I began a series of tests using an analog to digital interface and a force probe to measure force and time data and integrated these curves to obtain impulse data for various rocket motors. I have to say that the published data is very close to my measurements. The first bit of code presented here represents a rocket flight simulation for an Estes A-8 rocket motor pushing a 37 gram rocket. This includes a parachute deployment and subsequent terminal velocity to ground. Again- John Fisher is the author.

'EstesA8.bas
 
 'This program uses the thrust data to draw a position/time, velocity/time, and acceleration/time
 'graph for a rocket of mass 37 grams and an A-8 Estes engine.
 
 nomainwin
 
 UpperLeftX = 10
 UpperLeftY = 10
 WindowWidth = 1100
 WindowHeight = 700
 
 graphicbox #w.g, 10, 10, 1010, 610
 textbox #w.t, 10, 620, 610, 30
 
 open "Rocket vertical flight simulation" for window as #w
 
 #w, "trapclose [quit]"
 #w.g, "size 2 ; goto 5 505 ; down ; goto 950 505"
 
 
 RocketBodyMass = 0.030 ' fixed mass of rocket body
 
 RocketFuelMass = 0.0033 ' 3.3 gram of fuel
 EngineCasingMass = 0.0164 ' 17gram casing & nozzle.
 burntime = .7 ' burn lasts for this time
 burnrate = RocketFuelMass / burntime ' assume linear reaction rate
 
 Area = 0.0004 ' cross sectional area of rocket
 Gravity = 9.81 ' acceleration of gravity
 AirDensity = 1.2 ' density of air
 DragCoefficient = 0.75 ' allows for the streamlined shape
 
 
 
 y = 0 ' initial vertical height
 vy = 0 ' initial vertical displacement
 
 time = 0 ' initial time
 deltat = 0.001 ' time interval between updates
 
 acceleration = 0
 hasTakenOff = 0
 
global RocketBodyMass, RocketFuelMass, EngineCasingMass, burntime, burnrate
global Area, Gravity, DragCoefficient, y, vy, time, deltat , Gravity, AirDensity
 
 
[here]
 force =thrust( time) - Gravity * mass( time) - drag( time)
 
 if hasTakenOff <>0 then acceleration =force / mass( time) else acceleration =0
 if thrust( time) >( mass( time) *Gravity) then hasTakenOff =1
 
 vy = vy + acceleration *deltat
 #w.g, "color green ; set "; 5 +600 *time /10; " "; 505 -500 *vy /250
 
 y = y + vy *deltat
 
 time = time + deltat
 
 #w.t, " Time = "; using( "##.###", time); " force = "; using( "##.###", force);_
 " acceleration = "; using( "#####.##", acceleration); " velocity = "; using( "###.##", vy);_
 " and height = "; using("#######.##", y)
 
 #w.g, "color black ; set "; 5 +600 *time /10; " "; 505 -500 *y /120
 
 scan
 
 if y <500 and y >-.1 then goto [here]
 
 wait
 ' _____________________________________________________________________
 function thrust( tt)
 th =0
 if tt <=.7 then th = -0.0229 *tt +2.362
 if tt <=0.395 then th = -10.9 *tt +6.662
 if tt <=0.27 then th = -151.3 *tt +44.54
 if tt <=0.225 then th = 53.49 *tt -2.049
 if tt <0.035 then th = 0.0
 ' if tt <=1.6 then th =3
 'if tt <=0.3 then th=10 -80 *( tt -0.2)
 ' if tt <=0.2 then th =50 *tt
 
 #w.g, "color red ; set "; 5 +600 *time /10; " "; 505 -500 *th /50
 thrust =th
 end function
 ' _____________________________________________________________________
 function mass( tt)
 select case tt
 case tt <=1.6 ' it burns 0.0035kg in 0.7s.
 m =RocketBodyMass +EngineCasingMass + RocketFuelMass - tt *burnrate
 case else
 m =RocketBodyMass +EngineCasingMass
 end select
 
 mass =m
 end function
'____________________________________________________________________________
 function drag( tt)
 if vy >0 then drag =0.5 *AirDensity*vy^2 *DragCoefficient *Area else drag = -0.5 *AirDensity *vy^2 *DragCoefficient *Area
 if tt >6 then drag =-0.5 *AirDensity *vy^2 *DragCoefficient *0.05
 end function
 
[quit]
 close #w
 end