Orbital simulation - Calculate object position over time in a 2d plane

  • Thread starter ryanie
  • Start date
  • #1
9
0
Hi

Im busy creating an application to simulation a rocket in orbit. Im having trouble as the results im getting are incorrect. Could someone please check if im using the correct method as stated below.

Everything works on a 2d plane, and has a x and y coordinate and a x and y velocity and a mass
coordinates are in meters and the mass is in kg.

Method:
Calculate the distance between the rocket and the planet using the distance formula
distance = sqrt[ ( x2 - x1)^2 - (y2 - y1)^2 ]

calculate the force earth exerts on the rocket using the The Universal Law of Gravitation where G is the Gravitational constant m is the mass of an object and r is the distance between them
force = (G*m1*m2) / distance^2

Using the inverse of tan get the angle to calculate the the x and y components ( I know for a fact im getting this is correct, its a bit tricky to explain) I calculate the angle for each quadrant going from the x axis to the y axis

Calculate the acceleration of the rocket
acceleration = force / mass

Calculate velocity change over timer ( this is usually 0.01 seconds )
deltaVelocity = acceleration * time

Calculate the x velocity component
deltaXvelocity = deltaVelocity * cos(angle)

Calculate the y velocity component
deltaYvelocity = deltaVelocity * sin(angle)

Calculate the new x velocity
newXvelocity = currentXvelocity + deltaXvelocity

Calculate the new y velocity
newYvelocity = currentYvelocity + deltaYvelocity

set the new position of the rocket
newXposition = currentXposition + ( newXvelocity * time )
newYposition = currentYposition + ( newYvelocity * time )

Something is wrong with this method and i do know what.
I know for a fact that a an object in orbit round about 420km travelling at round about 7700 m/s should be in a roughly circular orbit and one that has a high eccentricity.

Currently with the results im getting to obtain a roughly circular orbit at 420km i need to have a velocity of round about 5500m/s

Thanks for taking the time
 

Answers and Replies

  • #2
Khashishi
Science Advisor
2,815
493

Related Threads on Orbital simulation - Calculate object position over time in a 2d plane

Replies
6
Views
2K
  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
7
Views
23K
Replies
5
Views
1K
Replies
7
Views
2K
Replies
3
Views
2K
  • Last Post
Replies
1
Views
1K
Replies
3
Views
1K
  • Last Post
Replies
4
Views
2K
Replies
7
Views
1K
Top