Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package fr.cs.examples.estimation;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.lang.Math;
public class logparser {
static double differencecalculator(double xg , double yg, double zg , double xd , double yd , double zd){
double diffx = xg - xd;
double diffy = yg - yd;
double diffz = zg - zd;
double diff = Math.sqrt(Math.pow(diffx,2)+ Math.pow(diffy,2)+Math.pow(diffz,2));
return diff;
}
static double[] splitter(String input){
String[] a = input.split("\\)");
String[] b = a[0].split(", ");
double output[] = new double[3];
for(int i=0; i<b.length;i++){
output[i]=Double.parseDouble(b[i]);
}
return output;
}
public static void main(String[] args) throws Exception {
boolean pv = true;
// Orbital parameters used in the generation of the measurements
double pxg = -5253194;
double pyg = -4400295;
double pzg = 80075;
double vxg = -559;
double vyg = 764;
double vzg = 7585;
// The sigma used in the generation
double sigma = 40;
File home = new File(System.getProperty("user.home"));
File orekitData = new File(home, "orekit-data");
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData));
/* Initial data path */
File log = new File("C:\\Users\\nolja\\orbit-determination-log.out");
boolean exists = log.exists();
System.out.println(exists);
BufferedReader reader = new BufferedReader(new FileReader(log));
String line = reader.readLine();
if(pv!=false) {
while(line!=null){
if(line.startsWith("Estimated orbit: Cartesian parameters:")){
System.out.println("Founbd it");
String[] chunks = line.split("\\(");
System.out.println(chunks[3]);
/*
// 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]));
System.out.println(differencecalculator(vxg,vyg,vzg,velocity[0],velocity[1],velocity[2]));
}
line = reader.readLine();
}
}
}
}