NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)

This model is a modification of "Solar System" by Jerry James (2/13/03). It allows one to compare the orbiting times of the six historical planets. The original model focuses on the effect of a comet. This version focuses on the relative orbit times of the planets.

This model mimics the solar system. Setup creates the sun and five planets. Unlike in the real solar system, these orbiting bodies are in the same plane, and setup distributes the planets randomly. However, the planets are at the
correct relative distances from the sun and have correct relative masses.
As the model is run, the number of orbits of each planet is given to three decimal places.

To Run the Model

Just press Setup. Setup resets Zoom to 15, which shows all six planets. To view the motions of the inner planets, increase Zoom. The initial angle of each planet is preserved with a radial line.

Press Go. It may be useful to slow down the model using the speed slider above the graphic window. Or to search for a specific value, use the "go once" button.

If you want to confirm Kepler's Law that relates the radius of the orbit to the period, compare each planet to the earth. The Procedures show the radius of each planet's orbit, and the year monitors show the number of orbits (years) compared to the earth years.


The speed adjustment actually changes the size of time intervals at which the new planet positions are updated. This affects the accuracy of the orbits. At a speed setting of 10 there are about 1000 updates of the position of the earth per
revolution of the sun, but only about 250 for Mercury. At a speed setting of 1 there are ten times as many updates per revolution. The effects of speed settings on the orbit calculations can be seen by setting the Sun_Only switch to "on" and
observing the orbital plots for both earth and comet at different speed settings. The ellipticity of the earth's orbit decreases as the number of updates per year increases.

While the Model is Running

To increase the speed of execution without affecting computation accuracy, turn the display off by pressing Display On/Off.
This is a toggle which alternately stops the display from showing the changing planet positions, or resumes showing their


Computing the acceleration of object #1 towards object #2 due to gravity:

From F = ma = -GMm/r^2 and solving for the x and y components of acceleration a we get accx = -GMx/r^3 and accy = -GMy/r^3
where accx and accy are the accelerations in the x and y directions, x and y are the distances in x and y directions between
the objects #1 and #2, M is the mass of object #2 (the mass m of object #1 cancels out), G is the gravitational constant, and
r = sqrt(x^2 + y^2). G is expressed in terms of Astronomical Units, AU and earth masses, Me, giving units of AU^3/(Me sec^2).

Computing the inital conditions

After the planets are randomly placed at their proper orbiting distances from the sun, the initial velocities are computed
from the equation v = -sqrt(G*M/r) where v = tangential velocity. The velocities in the x and y directions are then
x-velocity = v * sin (angle) and y-velocity = v * cos (angle) where angle is reported from (towards-nowrap sun - 180).

The initial accelerations are computed as described above, with each planet having the effects of the sun's and all the other
planets' gravity on itself computed.

At each time interval a new x and y position for each planet and the comet is computed based on the x and y velocities for
that time period. Since the velocities at the beginning of the time interval increase by (acceleration * time) the
average velocity for each time period is used. For the first time period this is computed by adding to the initial velocity
the acceleration * time/2.

(back to the NetLogo User Community Models)