Skip to content
Snippets Groups Projects
Commit 1bebb44e authored by noeljanes's avatar noeljanes
Browse files

Added write capability to the logparser

parent 24c3dfcf
No related branches found
No related tags found
No related merge requests found
Showing
with 8949 additions and 39 deletions
...@@ -209,7 +209,7 @@ public class MeasurementsGeneration { ...@@ -209,7 +209,7 @@ public class MeasurementsGeneration {
Range rate builder Range rate builder
*/ */
final double sigma = 0.25; // the value we will tune final double sigma = 40; // the value we will tune
final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { sigma * sigma }); final RealMatrix covariance = MatrixUtils.createRealDiagonalMatrix(new double[] { sigma * sigma });
final RandomGenerator random = new Well19937c(0x9e9409e2520c1fc3l); // you can change this seed as you like, it's just a seed final RandomGenerator random = new Well19937c(0x9e9409e2520c1fc3l); // you can change this seed as you like, it's just a seed
......
...@@ -268,6 +268,7 @@ public class OrbitDetermination { // Class 1 ...@@ -268,6 +268,7 @@ public class OrbitDetermination { // Class 1
for (final String fileName : parser.getStringsList(ParameterKey.MEASUREMENTS_FILES, ',')) { for (final String fileName : parser.getStringsList(ParameterKey.MEASUREMENTS_FILES, ',')) {
System.out.println(fileName); System.out.println(fileName);
if (Pattern.matches(RinexLoader.DEFAULT_RINEX_2_SUPPORTED_NAMES, fileName) || if (Pattern.matches(RinexLoader.DEFAULT_RINEX_2_SUPPORTED_NAMES, fileName) ||
Pattern.matches(RinexLoader.DEFAULT_RINEX_3_SUPPORTED_NAMES, fileName)) { Pattern.matches(RinexLoader.DEFAULT_RINEX_3_SUPPORTED_NAMES, fileName)) {
// the measurements come from a Rinex file // the measurements come from a Rinex file
...@@ -627,7 +628,7 @@ public class OrbitDetermination { // Class 1 ...@@ -627,7 +628,7 @@ public class OrbitDetermination { // Class 1
final double cd = parser.getDouble(ParameterKey.DRAG_CD); final double cd = parser.getDouble(ParameterKey.DRAG_CD);
final double area = parser.getDouble(ParameterKey.DRAG_AREA); final double area = parser.getDouble(ParameterKey.DRAG_AREA);
final boolean cdEstimated = parser.getBoolean(ParameterKey.DRAG_CD_ESTIMATED); final boolean cdEstimated = parser.getBoolean(ParameterKey.DRAG_CD_ESTIMATED);
System.out.println(cd);
MarshallSolarActivityFutureEstimation msafe = MarshallSolarActivityFutureEstimation msafe =
new MarshallSolarActivityFutureEstimation(MarshallSolarActivityFutureEstimation.DEFAULT_SUPPORTED_NAMES, new MarshallSolarActivityFutureEstimation(MarshallSolarActivityFutureEstimation.DEFAULT_SUPPORTED_NAMES,
MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE); MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE);
......
...@@ -3,25 +3,23 @@ package fr.cs.examples.estimation; ...@@ -3,25 +3,23 @@ package fr.cs.examples.estimation;
import org.orekit.data.DataProvidersManager; import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler; import org.orekit.data.DirectoryCrawler;
import java.io.BufferedReader; import java.io.*;
import java.io.File;
import java.io.FileReader;
import java.lang.Math; import java.lang.Math;
public class logparser { public class LogParser {
static double differencecalculator(double xg , double yg, double zg , double xd , double yd , double zd){ static private double differencecalculator(double xg , double yg, double zg , double xd , double yd , double zd){
double diffx = xg - xd; double diffx = xg - xd;
double diffy = yg - yd; double diffy = yg - yd;
double diffz = zg - zd; double diffz = zg - zd;
double diff = Math.sqrt(Math.pow(diffx,2)+ Math.pow(diffy,2)+Math.pow(diffz,2)); return Math.sqrt(Math.pow(diffx,2)+ Math.pow(diffy,2)+Math.pow(diffz,2));
return diff;
} }
static double[] splitter(String input){ static private double[] splitter(String input){
String[] a = input.split("\\)"); String[] a = input.split("\\)");
String[] b = a[0].split(", "); String[] b = a[0].split(", ");
double output[] = new double[3]; double[] output = new double[3];
for(int i=0; i<b.length;i++){ for(int i=0; i<b.length;i++){
output[i]=Double.parseDouble(b[i]); output[i]=Double.parseDouble(b[i]);
} }
...@@ -30,12 +28,10 @@ public class logparser { ...@@ -30,12 +28,10 @@ public class logparser {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
boolean pv = true; boolean pv = true;
// Orbital parameters used in the generation of the measurements // Orbital parameters used in the generation of the measurements
double pxg = -5253194; double pxg = -5253194;
double pyg = -4400295; double pyg = -4400295;
...@@ -45,54 +41,68 @@ public class logparser { ...@@ -45,54 +41,68 @@ public class logparser {
double vzg = 7585; double vzg = 7585;
// The sigma used in the generation // The sigma used in the generation
double sigma = 40; //double sigma = 0.25;
String stationID = "F4KLD-UNIVERSITE-PAUL-SABATIER-Toulouse-III";
File home = new File(System.getProperty("user.home")); File home = new File(System.getProperty("user.home"));
File orekitData = new File(home, "orekit-data"); File orekitData = new File(home, "orekit-data");
DataProvidersManager manager = DataProvidersManager.getInstance(); DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData)); manager.addProvider(new DirectoryCrawler(orekitData));
File pythonPath = new File(home, "\\Documents\\ESA Socis\\Orbit Determination\\Python plotting\\");
/* Initial data path */ /* Initial data path */
File log = new File("C:\\Users\\nolja\\orbit-determination-log.out"); File log = new File(pythonPath+"\\Drag\\F4LKD");
String[] folderlist = log.list();
boolean exists = log.exists(); boolean exists = log.exists();
System.out.println(exists); System.out.println(exists);
BufferedReader reader = new BufferedReader(new FileReader(log));
String line = reader.readLine();
if(pv!=false) { File outputFile = new File(pythonPath +"\\"+stationID+ "-drag.txt");
if (!outputFile.exists()) {
outputFile.createNewFile();
}
for( String folderName : folderlist) {
BufferedReader reader = new BufferedReader(new FileReader(log+"\\" + folderName + "\\orbit-determination-log.out"));
String line = reader.readLine();
while(line!=null){ if (pv != false) {
if(line.startsWith("Estimated orbit: Cartesian parameters:")){ while (line != null) {
System.out.println("Founbd it");
String[] chunks = line.split("\\(");
System.out.println(chunks[3]);
/* if (line.startsWith("Estimated orbit: Cartesian parameters:")) {
// Splitting the position string
String[] pos = chunks[1].split("\\)");
String[] posax = pos[0].split(", ");
double pxd = Double.parseDouble(posax[0]);
double pyd = Double.parseDouble(posax[1]);
double pzd = Double.parseDouble(posax[2]);*/
double[] position = splitter(chunks[1]);
double[] velocity = splitter(chunks[2]);
double[] a = splitter(chunks[3]);
System.out.println(differencecalculator(pxg,pyg,pzg,position[0],position[1],position[2])); String[] chunks = line.split("\\(");
System.out.println(differencecalculator(vxg,vyg,vzg,velocity[0],velocity[1],velocity[2]));
}
line = reader.readLine(); double[] position = splitter(chunks[1]);
} double[] velocity = splitter(chunks[2]);
} double[] a = splitter(chunks[3]);
double pDiff = differencecalculator(pxg, pyg, pzg, position[0], position[1], position[2]);
double vDiff = differencecalculator(vxg, vyg, vzg, velocity[0], velocity[1], velocity[2]);
String outputline = folderName + " " + pDiff + " " + vDiff + "\n";
try {
FileWriter fw = new FileWriter(outputFile, true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(outputline);
bw.close();
} catch (IOException ioe) {
System.err.println("Writer failed");
}
}
line = reader.readLine();
}
}
}
} }
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment