Files
EP2/src/Simulation4.java
2022-04-27 19:00:45 +02:00

54 lines
2.2 KiB
Java

import codedraw.CodeDraw;
import java.awt.*;
/**
* Simulates the formation of a massive solar system.
*/
public class Simulation4 {
// gravitational constant
public static final double G = 6.6743e-11;
// one astronomical unit (AU) is the average distance of earth to the sun.
public static final double AU = 150e9; // meters
// one light year
public static final double LY = 9.461e15; // meters
// some further constants needed in the simulation
public static final double SUN_MASS = 1.989e30; // kilograms
public static final double SUN_RADIUS = 696340e3; // meters
public static final double EARTH_MASS = 5.972e24; // kilograms
public static final double EARTH_RADIUS = 6371e3; // meters
// set some system parameters
public static final double SECTION_SIZE = 10 * AU; // the size of the square region in space
// all quantities are based on units of kilogram respectively second and meter.
/**
* The main simulation method using instances of other classes.
*/
public static void main(String[] args) {
// simulation
CodeDraw cd = new CodeDraw();
// create solar system with 12 bodies
NamedBodyForcePair sun = new NamedBodyForcePair(SolSystem4.SUN);
NamedBodyForcePair earth = new NamedBodyForcePair(SolSystem4.EARTH);
NamedBodyForcePair moon = new NamedBodyForcePair(SolSystem4.MOON);
NamedBodyForcePair mars = new NamedBodyForcePair(SolSystem4.MARS);
NamedBodyForcePair deimos = new NamedBodyForcePair(SolSystem4.DEIMOS);
NamedBodyForcePair phobos = new NamedBodyForcePair(SolSystem4.PHOBOS);
NamedBodyForcePair mercury = new NamedBodyForcePair(SolSystem4.MERCURY);
NamedBodyForcePair venus = new NamedBodyForcePair(SolSystem4.VENUS);
NamedBodyForcePair vesta = new NamedBodyForcePair(SolSystem4.VESTA);
NamedBodyForcePair pallas = new NamedBodyForcePair(SolSystem4.PALLAS);
NamedBodyForcePair hygiea = new NamedBodyForcePair(SolSystem4.HYGIEA);
NamedBodyForcePair ceres = new NamedBodyForcePair(SolSystem4.CERES);
//TODO: implementation of this method according to 'Aufgabenblatt4.md'.
}
}