1
0
mirror of https://github.com/christiaangoossens/Planetary-Orbit-Simulator synced 2025-07-06 11:00:47 +00:00

Some testing with the new processing system

This commit is contained in:
Christiaan Goossens
2016-12-10 15:32:54 +01:00
parent 9afecf0f0d
commit e1e616b28a
5 changed files with 125 additions and 150 deletions

View File

@ -59,7 +59,7 @@ public class Main {
* Object listing
*/
Object[] objects = {sun, earth, moon, jupiter};
Object[] objects = {sun, jupiter, saturn, neptune, uranus, object1};
/**

View File

@ -5,15 +5,15 @@ public class SimulatorConfig {
* Time settings
*/
public static int rounds = 48; // Amount of rounds to run the simulator for // 3000000 = 250.000 jaar
public static double time = 3600; // Time steps in seconds // 259200 = 1 month
public static int rounds = 3000000; // Amount of rounds to run the simulator for // 3000000 = 250.000 jaar
public static double time = 259200; // Time steps in seconds // 259200 = 1 month
/**
* Object settings
*/
public static String sunName = "Sun"; // The name of the sun to calculate values TO
public static String[] objectNames = { "Earth" }; // The name of the object(s) your want to calculate the values OF
public static String[] objectNames = { "Sedna" }; // The name of the object(s) your want to calculate the values OF
/**
* Output preferences
@ -29,4 +29,9 @@ public class SimulatorConfig {
*/
public static boolean logConsole = false;
public static int skipConsole = 100000;
/**
* Processor settings
*/
public static int moduloArgument = 12*100;
}

View File

@ -48,96 +48,17 @@ public class Processor {
for(String objectName : SimulatorConfig.objectNames) {
SimpleObjectProcessor object = this.objects.get(objectName);
object.setObjectData(objects.get(objectName));
object.calculateAOP();
//object.setReferenceObjectData(objects.get(SimulatorConfig.sunName));
//object.processHistory();
// Check if the object has gone round last round
//boolean round = object.processRoundCheck();
/*if (round) {
// Process the nodes
object.processNodes();
// ECHO:: Object has gone full circle last round!
System.out.println("\n\n============== ROTATION DATA: " + objectName.toUpperCase() + ", ROUND " + (Simulator.round - 1) + " =============");
if (SimulatorConfig.outputUnit.equals("AU")) {
//System.out.println("Current position (AU): " + AU.convertFromMeter(objects.get(objectName).position) + "\n");
//System.out.println("Highest point (z-axis graph) (AU): " + AU.convertFromMeter(object.absoluteMax));
//System.out.println("Lowest point (z-axis graph) (AU): " + AU.convertFromMeter(object.absoluteMin));
//System.out.println("Calculated reference height (AU) : " + AU.convertFromMeter(object.referenceZ) + "\n");
if (object.ascendingNode != null) {
System.out.println("Ascending node (AU): " + AU.convertFromMeter(object.ascendingNode));
} else {
System.out.println("WARNING:: Ascending node not found.");
}
if (object.descendingNode != null) {
System.out.println("Descending node (AU): " + AU.convertFromMeter(object.descendingNode) + "\n");
} else {
System.out.println("WARNING:: Descending node not found.\n");
}
//System.out.println("Position during apastron (AU): " + AU.convertFromMeter(object.aphelion));
System.out.println("Distance from (the) " + SimulatorConfig.sunName + " during apastron in km: " + object.aphelionDistance / 1000 + "\n");
//System.out.println("Position during periastron (AU): " + AU.convertFromMeter(object.perihelion));
System.out.println("Distance from (the) " + SimulatorConfig.sunName + " during periastron in km: " + object.perihelionDistance / 1000 + "\n");
} else {
//System.out.println("Current position (m): " + objects.get(objectName).position + "\n");
//System.out.println("Highest point (z-axis graph) (m): " + object.absoluteMax);
//System.out.println("Lowest point (z-axis graph) (m): " + object.absoluteMin);
//System.out.println("Calculated reference height (m) : " + object.referenceZ + "\n");
if (object.ascendingNode != null) {
System.out.println("Ascending node (m): " + object.ascendingNode);
} else {
System.out.println("WARNING:: Ascending node not found.");
}
if (object.descendingNode != null) {
System.out.println("Descending node (m): " + object.descendingNode + "\n");
} else {
System.out.println("WARNING:: Descending node not found.\n");
}
//System.out.println("Position during apastron (m): " + object.aphelion);
System.out.println("Distance from (the) " + SimulatorConfig.sunName + " during apastron in km: " + object.aphelionDistance / 1000);
//System.out.println("Position during periastron (m): " + object.perihelion);
System.out.println("Distance from (the) " + SimulatorConfig.sunName + " during periastron in km: " + object.perihelionDistance / 1000 + "\n");
// Check if we need to calculate the AOP
if (Simulator.round % SimulatorConfig.moduloArgument == 0) {
if (arguments.get(objectName) == null) {
// If not defined
ArrayList<Double> agmnts = new ArrayList<>();
arguments.put(objectName, agmnts);
}
if (object.ascendingNode != null) {
System.out.println("Argument of periapsis (radians): " + AOP.calculate(object.ascendingNode, object.perihelion, object.aphelion));
//System.out.println("Argument of periapsis (degrees): " + Math.toDegrees(AOP.calculate(object.ascendingNode, object.perihelion, object.aphelion)));
if (object.checkNodes()) {
// Add the node to the list
if (arguments.get(objectName) == null) {
// If not defined
ArrayList<Double> agmnts = new ArrayList<>();
arguments.put(objectName, agmnts);
}
arguments.get(objectName).add(AOP.calculate(object.ascendingNode, object.perihelion, object.aphelion));
}
} else {
System.out.println("ERROR:: Can't calculate the argument of periapsis because the ascending node is missing.");
}
System.out.println("=======================================================================================\n\n");
object.reset();
// Reset starting position
this.objects.get(objectName).setStartingPosition(objects.get(objectName).position);
}*/
// Process values for this round
//object.processAphelionAndPerihelion();
//object.calculateTops();
arguments.get(objectName).add(object.calculateAOP());
}
this.objects.put(objectName, object);
}

View File

@ -10,7 +10,7 @@ public class SimpleObjectProcessor {
this.thisObject = object;
}
public void calculateAOP() {
public double calculateAOP() {
// ORBITAL MOMENTUM VECTOR
Vector3d orbitalMomentum = new Vector3d(0,0,0);
Object object = this.thisObject;
@ -44,6 +44,6 @@ public class SimpleObjectProcessor {
aop = ascendingNode.angle(eccentricity);
}
System.out.println("Orbital momentum vector: " + orbitalMomentum + " & accending node: " + ascendingNode + " & eccentricity vector: " + eccentricity + " & aop: " + Math.toDegrees(aop));
return aop;
}
}