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 formula

This commit is contained in:
Christiaan Goossens
2016-12-04 17:07:59 +01:00
parent 2e732967cd
commit 9afecf0f0d
13 changed files with 161 additions and 432 deletions

View File

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

View File

@ -5,15 +5,15 @@ public class SimulatorConfig {
* Time settings
*/
public static int rounds = 3000000; // Amount of rounds to run the simulator for // 3000000 = 250.000 jaar
public static double time = 2592000; // Time steps in seconds // 259200 = 1 month
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
/**
* Object settings
*/
public static String sunName = "Sun"; // The name of the sun to calculate values TO
public static String[] objectNames = { "Sedna", "2012 VP113" }; // The name of the object(s) your want to calculate the values OF
public static String[] objectNames = { "Earth" }; // The name of the object(s) your want to calculate the values OF
/**
* Output preferences

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
public class Processor {
private DataWriter writer;
public HashMap<String, Object> initialObjectValues = new HashMap<>();
public HashMap<String, ObjectProcessor> objects = new HashMap<>();
public HashMap<String, SimpleObjectProcessor> objects = new HashMap<>();
public HashMap<String, ArrayList<Double>> arguments = new HashMap<>();
public Processor(Object[] objects) throws ProcessingException, WritingException {
@ -35,8 +35,7 @@ public class Processor {
* Create the object processing array
*/
for (Object object : initialObjectValues.values()) {
this.objects.put(object.name, new ObjectProcessor());
this.objects.get(object.name).setStartingPosition(object.position);
this.objects.put(object.name, new SimpleObjectProcessor());
}
}
@ -47,16 +46,16 @@ public class Processor {
* Only do the processing for the asked planet(s)
*/
for(String objectName : SimulatorConfig.objectNames) {
ObjectProcessor object = this.objects.get(objectName);
SimpleObjectProcessor object = this.objects.get(objectName);
object.setObjectData(objects.get(objectName));
object.setReferenceObjectData(objects.get(SimulatorConfig.sunName));
object.processHistory();
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) {
//boolean round = object.processRoundCheck();
/*if (round) {
// Process the nodes
object.processNodes();
@ -134,11 +133,11 @@ public class Processor {
// Reset starting position
this.objects.get(objectName).setStartingPosition(objects.get(objectName).position);
}
}*/
// Process values for this round
object.processAphelionAndPerihelion();
object.calculateTops();
//object.processAphelionAndPerihelion();
//object.calculateTops();
this.objects.put(objectName, object);
}

View File

@ -0,0 +1,49 @@
package com.verictas.pos.simulator.processor;
import com.verictas.pos.simulator.Object;
import javax.vecmath.Vector3d;
public class SimpleObjectProcessor {
private Object thisObject;
public void setObjectData(Object object) {
this.thisObject = object;
}
public void calculateAOP() {
// ORBITAL MOMENTUM VECTOR
Vector3d orbitalMomentum = new Vector3d(0,0,0);
Object object = this.thisObject;
orbitalMomentum.cross(object.speed, object.position);
// ACCENDING NODE VECTOR
Vector3d ascendingNode = new Vector3d(0,0,0);
ascendingNode.cross(new Vector3d(0,0,1), orbitalMomentum);
// ECCENTRICITY VECTOR
double mu = 1.32712440018E20;
Vector3d upCross = new Vector3d(0,0,0);
upCross.cross(object.speed, orbitalMomentum);
upCross.scale(1/mu);
double posLength = object.position.length();
Vector3d rightPos = object.position;
rightPos.scale(1/posLength);
Vector3d eccentricity = new Vector3d(0,0,0);
eccentricity.sub(upCross, rightPos);
// AOP
double aop;
if (eccentricity.getZ() < 0) {
aop = (2 * Math.PI) - ascendingNode.angle(eccentricity);
} else {
aop = ascendingNode.angle(eccentricity);
}
System.out.println("Orbital momentum vector: " + orbitalMomentum + " & accending node: " + ascendingNode + " & eccentricity vector: " + eccentricity + " & aop: " + Math.toDegrees(aop));
}
}