The flight of a rocket can be
modelled mathematically using a 2nd order differential equation involving position,
and its time derivatives, velocity and acceleration. One approach
to solving higher
order differential equations
numerically is to
split the equation
into a number of 1st
order differential equations
which can be
solved by approximating
gradients. (If you want to read
more, look up Euler’s forward method in any good applied mathematics
textbook.)
In
one dimension, assume
at time k we know
values the instantaneous
acceleration ak, velocity vk, and
position xk of the rocket. Using “forward differencing” involving the velocity vk+1of
the rocket at timestep k+ 1 a small time ∆t later, the acceleration can be
written as
so that
Similarly, using velocity and
position
Hence, provided you know the
position and velocity of the rocket at any time step k, and you have an independent
way of working out the acceleration at that time step, these equations form a
scheme to compute position and velocity at the next time step k+ 1, and so on
over all time
Saturn V:
Value 

Initial
Mass 
2900
(metric tons) 
Total
Thrust at Launch 
3400kN 
Stage
1 Burn Time 
150sec 
Stage
1 Propellant Mass 
2150000
kG 
Max
Diameter 
10 m 
Length 
110m
(360 feet) 
Stages 
3 
For this exercise we will focus on
the first stage.
Note: Some data input to this program and some program
output depends on <your name>. If you do not use your name as required, points will be deducted for this assignment.
The <your
name> Vertical Rocket
Launch Simulation Program should be included in a welcome message at the
beginning of the program.
Write a program that performs
rocket launch simulation – for this exercise we will focus on the first stage
booster, but total propellant will be used in the calculations. The program should prompt for the rocket’s
thrust, mass, and burn time and then use a repetition structure to generation
the detail report, followed by a summary report.
1.
Declare variables and Named constants.
2.
Display “Welcome to <your name>’s Vertical Rocket Launch Simulator”
3.
Prompt for the rocket mass
4.
Prompt for the Rocket Thrust
5.
Prompt for the Burn time
6.
Display major heading
7.
Display Column headings
8.
Use pretest for loop or while loop – hint use a
control variable “t” for time in seconds.
9.
Calculate gravity
a.
g= (6.673e11*5.98e24)/ Math.pow((radius +
h),2);
10.
Calculate Thrust (t represents the control
variable t for time
a.
if (t>=0 && t<burnTime)
force=thrust else force=0
11.
Calculate mass (note mass decreases as fuel is
consumed.
a.
if(t>0 && t<burnTime) m=mass 
mass*fuelPct*(t/burnTime);
else m=mass * (1fuelPct);
12.
Calculate d for drag (use constant .6)
13.
Calculate Acceleration
a.
a=(forcem*g d)/m;
14.
Calculate height (dt represent delta time or 1
second)
a.
h =
h + dt * v; /
15.
Calculate new velocity
a.
v =
v + dt * a;
16.
Print time, height, velocity, acceleration, and
mass
17.
Break out of loop if height is negative
a.
if (h<0) break;
18.
Compute max height and velocity
19.
Compute avg velocity
20.
Save time of max height
21.
end of loop
22.
Display the summary report heading
23.
Display Apogee
24.
Display time of Apogee.
25.
Display max velocity
26.
Display average velocity