diff --git a/simulator/.idea/workspace.xml b/simulator/.idea/workspace.xml index 652d70b..9c03114 100644 --- a/simulator/.idea/workspace.xml +++ b/simulator/.idea/workspace.xml @@ -7,13 +7,10 @@ - + + - - - - @@ -35,40 +32,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - @@ -167,6 +131,8 @@ + + @@ -285,8 +251,6 @@ - - @@ -590,18 +554,18 @@ - - + + - + - + - + @@ -657,10 +621,7 @@ - - - - + @@ -675,10 +636,7 @@ - - - - + @@ -687,16 +645,7 @@ - - - - - - - - - @@ -707,8 +656,6 @@ - - @@ -732,10 +679,7 @@ - - - - + @@ -744,16 +688,7 @@ - - - - - - - - - @@ -764,8 +699,6 @@ - - @@ -789,10 +722,7 @@ - - - - + @@ -801,16 +731,7 @@ - - - - - - - - - @@ -821,8 +742,6 @@ - - @@ -846,10 +765,7 @@ - - - - + @@ -858,16 +774,7 @@ - - - - - - - - - @@ -878,8 +785,6 @@ - - @@ -904,16 +809,7 @@ - - - - - - - - - @@ -924,8 +820,6 @@ - - @@ -997,10 +891,6 @@ - - - - @@ -1008,20 +898,10 @@ - - - - - - - - - - - + @@ -1043,20 +923,6 @@ - - - - - - - - - - - - - - @@ -1079,7 +945,6 @@ - @@ -1096,30 +961,40 @@ - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/simulator/out/production/simulator/com/verictas/pos/simulator/SimulatorConfig.class b/simulator/out/production/simulator/com/verictas/pos/simulator/SimulatorConfig.class index 2435287..e84cc59 100644 Binary files a/simulator/out/production/simulator/com/verictas/pos/simulator/SimulatorConfig.class and b/simulator/out/production/simulator/com/verictas/pos/simulator/SimulatorConfig.class differ diff --git a/simulator/out/production/simulator/com/verictas/pos/simulator/processor/Processor.class b/simulator/out/production/simulator/com/verictas/pos/simulator/processor/Processor.class index 977a8c2..54e4553 100644 Binary files a/simulator/out/production/simulator/com/verictas/pos/simulator/processor/Processor.class and b/simulator/out/production/simulator/com/verictas/pos/simulator/processor/Processor.class differ diff --git a/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java b/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java index 0b1a924..e72e480 100644 --- a/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java +++ b/simulator/src/com/verictas/pos/simulator/SimulatorConfig.java @@ -5,7 +5,7 @@ public class SimulatorConfig { * Time settings */ - public static int rounds = 526100 * 250; // Amount of rounds to run the simulator for + public static int rounds = 526100 * 1000; // Amount of rounds to run the simulator for public static double time = 60; // Time steps in seconds /** diff --git a/simulator/src/com/verictas/pos/simulator/processor/Processor.java b/simulator/src/com/verictas/pos/simulator/processor/Processor.java index 4842313..c3a1881 100644 --- a/simulator/src/com/verictas/pos/simulator/processor/Processor.java +++ b/simulator/src/com/verictas/pos/simulator/processor/Processor.java @@ -15,8 +15,7 @@ public class Processor { private DataWriter writer; public HashMap initialObjectValues = new HashMap<>(); public HashMap objects = new HashMap<>(); - - public ArrayList arguments = new ArrayList<>(); + public HashMap> arguments = new HashMap<>(); public Processor(Object[] objects) throws ProcessingException, WritingException { /** @@ -83,9 +82,9 @@ public class Processor { } //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("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"); + //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); @@ -105,17 +104,24 @@ public class Processor { } //System.out.println("Position during apastron (m): " + object.aphelion); - System.out.println("Distance from (the) " + SimulatorConfig.sunName + " during apastron in km: " + object.aphelionDistance / 1000 + "\n"); + ///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"); + //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))); + //System.out.println("Argument of periapsis (degrees): " + Math.toDegrees(AOP.calculate(object.ascendingNode, object.perihelion, object.aphelion))); if (object.checkNodes()) { - arguments.add(Math.toDegrees(AOP.calculate(object.ascendingNode, object.perihelion, object.aphelion))); + // 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 { @@ -166,18 +172,30 @@ public class Processor { public void close() throws ProcessingException { try { this.writer.save(); + System.out.println("RESULTS: " + arguments); - // CALCULATE AVERAGE + for(String objectName : SimulatorConfig.objectNames) { + ArrayList arguments = this.arguments.get(objectName); + double score = 0; - double sum = 0; - for (int i = 0; i < arguments.size(); i++){ - sum = sum + arguments.get(i); + // Calculate score + for(int i = 1; i < arguments.size() - 1; i++) { + score = score + Math.abs(arguments.get(i-1) - arguments.get(i)); + } + + System.out.println("SCORE: " + score); + + // CALCULATE AVERAGE + double sum = 0; + for (int i = 0; i < arguments.size(); i++){ + sum = sum + arguments.get(i); + } + // calculate average + double average = sum / arguments.size(); + + System.out.println("AVERAGE (degrees): " + Math.toDegrees(average)); } - // calculate average - double average = sum / arguments.size(); - - System.out.println("AVERAGE: " + average); } catch(WritingException e) { throw new ProcessingException("An error occurred during creation of the file writer: " + e.toString()); }