From 9afecf0f0d88e1d4761a69e8f180036bbac211f8 Mon Sep 17 00:00:00 2001 From: Christiaan Goossens Date: Sun, 4 Dec 2016 17:07:59 +0100 Subject: [PATCH] Some testing with the new formula --- monte-carlo/.idea/compiler.xml | 22 -- .../.idea/copyright/profiles_settings.xml | 3 - monte-carlo/.idea/misc.xml | 39 ---- monte-carlo/.idea/modules.xml | 8 - monte-carlo/.idea/workspace.xml | 221 ------------------ monte-carlo/monte-carlo.iml | 11 - simulator/.idea/misc.xml | 5 +- simulator/.idea/workspace.xml | 192 +++++++-------- simulator/simulator.iml | 2 +- .../src/com/verictas/pos/simulator/Main.java | 2 +- .../pos/simulator/SimulatorConfig.java | 6 +- .../pos/simulator/processor/Processor.java | 23 +- .../processor/SimpleObjectProcessor.java | 49 ++++ 13 files changed, 156 insertions(+), 427 deletions(-) delete mode 100644 monte-carlo/.idea/compiler.xml delete mode 100644 monte-carlo/.idea/copyright/profiles_settings.xml delete mode 100644 monte-carlo/.idea/misc.xml delete mode 100644 monte-carlo/.idea/modules.xml delete mode 100644 monte-carlo/.idea/workspace.xml delete mode 100644 monte-carlo/monte-carlo.iml create mode 100644 simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java diff --git a/monte-carlo/.idea/compiler.xml b/monte-carlo/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/monte-carlo/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/monte-carlo/.idea/copyright/profiles_settings.xml b/monte-carlo/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/monte-carlo/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/monte-carlo/.idea/misc.xml b/monte-carlo/.idea/misc.xml deleted file mode 100644 index 47095a6..0000000 --- a/monte-carlo/.idea/misc.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 1.8 - - - - - - - - \ No newline at end of file diff --git a/monte-carlo/.idea/modules.xml b/monte-carlo/.idea/modules.xml deleted file mode 100644 index 3c147ab..0000000 --- a/monte-carlo/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/monte-carlo/.idea/workspace.xml b/monte-carlo/.idea/workspace.xml deleted file mode 100644 index 7f1661d..0000000 --- a/monte-carlo/.idea/workspace.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1478875683077 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/monte-carlo/monte-carlo.iml b/monte-carlo/monte-carlo.iml deleted file mode 100644 index c90834f..0000000 --- a/monte-carlo/monte-carlo.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/simulator/.idea/misc.xml b/simulator/.idea/misc.xml index e29b6f0..e1fe88f 100644 --- a/simulator/.idea/misc.xml +++ b/simulator/.idea/misc.xml @@ -1,12 +1,9 @@ - - - - + \ No newline at end of file diff --git a/simulator/.idea/workspace.xml b/simulator/.idea/workspace.xml index 81cbe73..62ade7d 100644 --- a/simulator/.idea/workspace.xml +++ b/simulator/.idea/workspace.xml @@ -7,7 +7,19 @@ - + + + + + + + + + + + + + @@ -27,63 +39,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -171,9 +128,7 @@ - - @@ -286,12 +241,14 @@ + + - - + + @@ -340,6 +297,34 @@ + + + @@ -617,13 +602,6 @@ - - - - - - - @@ -918,27 +896,26 @@ - + - - + + - + - - + + + - - + + - - @@ -947,32 +924,42 @@ - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + @@ -984,8 +971,8 @@ - + simulator:jar @@ -1048,6 +1035,7 @@ + 1.7 diff --git a/simulator/src/com/verictas/pos/simulator/Main.java b/simulator/src/com/verictas/pos/simulator/Main.java index e484401..528f8af 100644 --- a/simulator/src/com/verictas/pos/simulator/Main.java +++ b/simulator/src/com/verictas/pos/simulator/Main.java @@ -59,7 +59,7 @@ public class Main { * Object listing */ - Object[] objects = {sun, jupiter, object1, object2}; + Object[] objects = {sun, earth, moon, jupiter}; /** diff --git a/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java b/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java index fd050ca..544e535 100644 --- a/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java +++ b/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java @@ -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 diff --git a/simulator/src/com/verictas/pos/simulator/processor/Processor.java b/simulator/src/com/verictas/pos/simulator/processor/Processor.java index ab8e2fd..ca3c741 100644 --- a/simulator/src/com/verictas/pos/simulator/processor/Processor.java +++ b/simulator/src/com/verictas/pos/simulator/processor/Processor.java @@ -14,7 +14,7 @@ import java.util.HashMap; public class Processor { private DataWriter writer; public HashMap initialObjectValues = new HashMap<>(); - public HashMap objects = new HashMap<>(); + public HashMap objects = new HashMap<>(); public HashMap> 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); } diff --git a/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java b/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java new file mode 100644 index 0000000..924cf8d --- /dev/null +++ b/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java @@ -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)); + } +}