From e1e616b28a992e9bc276e9abed6fbd89ecb2f3b0 Mon Sep 17 00:00:00 2001 From: Christiaan Goossens Date: Sat, 10 Dec 2016 15:32:54 +0100 Subject: [PATCH] Some testing with the new processing system --- simulator/.idea/workspace.xml | 153 ++++++++++++------ .../src/com/verictas/pos/simulator/Main.java | 2 +- .../pos/simulator/SimulatorConfig.java | 11 +- .../pos/simulator/processor/Processor.java | 95 +---------- .../processor/SimpleObjectProcessor.java | 4 +- 5 files changed, 120 insertions(+), 145 deletions(-) diff --git a/simulator/.idea/workspace.xml b/simulator/.idea/workspace.xml index 62ade7d..3536c1a 100644 --- a/simulator/.idea/workspace.xml +++ b/simulator/.idea/workspace.xml @@ -7,19 +7,11 @@ - - - - - - - - - + @@ -39,7 +31,63 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -128,7 +176,7 @@ - + @@ -241,7 +289,7 @@ - + @@ -542,7 +590,7 @@ - + @@ -552,20 +600,20 @@ - + - + - + - + @@ -896,13 +944,6 @@ - - - - - - - @@ -911,55 +952,63 @@ - + - - - - - - + + + - + - - + + - + - - - + + + + + - - + + - + - - + + + + + + + + + + - + + - + - - + + diff --git a/simulator/src/com/verictas/pos/simulator/Main.java b/simulator/src/com/verictas/pos/simulator/Main.java index 528f8af..18e7702 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, earth, moon, jupiter}; + Object[] objects = {sun, jupiter, saturn, neptune, uranus, object1}; /** diff --git a/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java b/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java index 544e535..a087b72 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 = 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; } diff --git a/simulator/src/com/verictas/pos/simulator/processor/Processor.java b/simulator/src/com/verictas/pos/simulator/processor/Processor.java index ca3c741..9f6ba43 100644 --- a/simulator/src/com/verictas/pos/simulator/processor/Processor.java +++ b/simulator/src/com/verictas/pos/simulator/processor/Processor.java @@ -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"); - } - - 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 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."); + // Check if we need to calculate the AOP + if (Simulator.round % SimulatorConfig.moduloArgument == 0) { + if (arguments.get(objectName) == null) { + // If not defined + ArrayList agmnts = new ArrayList<>(); + arguments.put(objectName, agmnts); } - 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); } diff --git a/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java b/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java index 924cf8d..1411372 100644 --- a/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java +++ b/simulator/src/com/verictas/pos/simulator/processor/SimpleObjectProcessor.java @@ -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; } }