COMP6730 Simulation Motion Planetary System
In this assignment you will develop a program to simulate the motion of a planetary system, such as our Solar system, in which we will project the movements in three-dimensional space onto a 2-dimensional plane.
Background
While the planets are obviously moving in a 3-dimensional space, it turns out that all eight planets in the Solar system nearly orbit in the same 2-dimensional plane (the ecliptic plane relative to the Sun). This observation allows us to simulate their trajectories in the 2D space. More generally, we want to model the movement of any planetary system in 2D, not just our Solar system. Each star/planet can be represented as a point in this 2D plane with coordinates (x,y). Storing
Storing configuration of a planetary system
Before doing any motion calculation we need to know the current configuration of the star and the planets, including their masses, positions and velocities in the planetary system. The file solar_system.tsv provides a real example of the configuration of our Solar system on 1st May 2020:
Name Mass XPOS YPOS XVEL YVEL
Sun 1.99e+30 0.00e+00 0.00e+00 0.00e+00 0.00e+00
Mercury 3.30e+23 4.51e+10 1.99e+10 -2.80e+04 4.72e+04
Venus 4.87e+24 -1.02e+11 -3.47e+10 1.14e+04 -3.32e+04
Earth 5.97e+24 -1.15e+11 -9.75e+10 1.90e+04 -2.27e+04
Mars 6.42e+23 2.87e+10 -2.12e+11 2.49e+04 5.39e+03
Jupiter 1.90e+27 2.10e+11 -7.45e+11 1.24e+04 4.18e+03
Saturn 5.68e+26 6.54e+11 -1.35e+12 8.15e+03 4.19e+03
Uranus 8.68e+25 2.38e+12 1.76e+12 -4.09e+03 5.16e+03
Neptune 1.02e+26 4.39e+12 -8.95e+11 1.05e+03 5.36e+03
This file is in tab-separated format with six columns. The first line is the header line showing the name of the columns and each of the remaining lines corresponds to a star/planet. The column meanings are:
- Name: Name of the star/planet.
- Mass: Its mass (kilograms).
- XPOS: x-coordinate (in meters) of the star/planet.
- YPOS: y-coordinate (in meters) of the star/planet.
- XVEL: x-velocity (in meters/second), the speed at which the star/planet is moving on the x-axis.
- YVEL: y-velocity (in meters/second), the speed at which the star/planet is moving on the y-axis.
We use the standard SI units for all quantities, i.e., time, mass, velocity, acceleration, etc. You can use the plot_configuration function provided in the skeleton file to visualise the configuration. For the solar_system.tsv you should see the following figure:
NOTE: You cannot assume that there are always 1 star and 8 planets with these names in a configuration file. In fact, we will test your code with other planetary systems such as trappist-1.tsv, which corresponds to the so-called TRAPPIST-1 multi-planetary system (discovered during the 21st century). However, you can assume that the header line will stay the same for all testing files.
Questions for analysis (code)
A template file for the assignment code is provided:
- assignment.py In this file, there are several functions that you must implement for tasks 1-5. These functions only have a pass statement that you should replace with your own implementation. You do not have to solve all the tasks, but you can only gain marks for the ones that you have attempted (see Marking criteria below for details on how we will mark your submission).