Commit 2981979f authored by Christopher Reis's avatar Christopher Reis

Added data verification

Prevents duplicate entries and updates the TLE from Celestrack
parent 7f52d4a1
<?xml version="1.0" encoding="UTF-8" standalone="no"?><satelliteDatabase><Created>Sat Oct 17 18:40:53 MDT 2015</Created><Satellite>GPS BIIA-10 (PRN 32)</Satellite><Satellite>GPS BIIA-23 (PRN 04)</Satellite><Satellite>GPS BIIA-24 (PRN 10)</Satellite><Satellite>GPS BIIR-2 (PRN 13)</Satellite><Satellite>GPS BIIR-3 (PRN 11)</Satellite><Satellite>GPS BIIR-4 (PRN 20)</Satellite><Satellite>GPS BIIR-5 (PRN 28)</Satellite><Satellite>GPS BIIR-6 (PRN 14)</Satellite><Satellite>GPS BIIR-7 (PRN 18)</Satellite><Satellite>GPS BIIR-8 (PRN 16)</Satellite><Satellite>GPS BIIR-9 (PRN 21)</Satellite><Satellite>GPS BIIR-10 (PRN 22)</Satellite><Satellite>GPS BIIR-11 (PRN 19)</Satellite><Satellite>GPS BIIR-12 (PRN 23)</Satellite><Satellite>GPS BIIR-13 (PRN 02)</Satellite><Satellite>GPS BIIRM-1 (PRN 17)</Satellite><Satellite>GPS BIIRM-2 (PRN 31)</Satellite><Satellite>GPS BIIRM-3 (PRN 12)</Satellite><Satellite>GPS BIIRM-4 (PRN 15)</Satellite><Satellite>GPS BIIRM-5 (PRN 29)</Satellite><Satellite>GPS BIIRM-6 (PRN 07)</Satellite><Satellite>GPS BIIRM-8 (PRN 05)</Satellite><Satellite>GPS BIIF-1 (PRN 25)</Satellite><Satellite>GPS BIIF-2 (PRN 01)</Satellite><Satellite>GPS BIIF-3 (PRN 24)</Satellite><Satellite>GPS BIIF-4 (PRN 27)</Satellite><Satellite>GPS BIIF-5 (PRN 30)</Satellite><Satellite>GPS BIIF-6 (PRN 06)</Satellite><Satellite>GPS BIIF-7 (PRN 09)</Satellite><Satellite>GPS BIIF-8 (PRN 03)</Satellite><Satellite>GPS BIIF-9 (PRN 26)</Satellite><Satellite>GPS BIIF-10 (PRN 08)</Satellite></satelliteDatabase>
\ No newline at end of file
This diff is collapsed.
GPS BIIA-10 (PRN 32)
GPS BIIA-23 (PRN 04)
GPS BIIA-24 (PRN 10)
GPS BIIR-2 (PRN 13)
GPS BIIR-3 (PRN 11)
GPS BIIR-4 (PRN 20)
GPS BIIR-5 (PRN 28)
GPS BIIR-6 (PRN 14)
GPS BIIR-7 (PRN 18)
GPS BIIR-8 (PRN 16)
GPS BIIR-9 (PRN 21)
GPS BIIR-10 (PRN 22)
GPS BIIR-11 (PRN 19)
GPS BIIR-12 (PRN 23)
GPS BIIR-13 (PRN 02)
GPS BIIRM-1 (PRN 17)
GPS BIIRM-2 (PRN 31)
GPS BIIRM-3 (PRN 12)
GPS BIIRM-4 (PRN 15)
GPS BIIRM-5 (PRN 29)
GPS BIIRM-6 (PRN 07)
GPS BIIRM-8 (PRN 05)
GPS BIIF-1 (PRN 25)
GPS BIIF-2 (PRN 01)
GPS BIIF-3 (PRN 24)
GPS BIIF-4 (PRN 27)
GPS BIIF-5 (PRN 30)
GPS BIIF-6 (PRN 06)
GPS BIIF-7 (PRN 09)
GPS BIIF-8 (PRN 03)
GPS BIIF-9 (PRN 26)
GPS BIIF-10 (PRN 08)
NOAA 1 [-]
NOAA 2 [-]
NOAA 3 [-]
NOAA 4 [-]
NOAA 5 [-]
TIROS N [P]
NOAA 6 [P]
NOAA 7 [-]
NOAA 8 [-]
NOAA 9 [P]
NOAA 10 [-]
NOAA 11 [-]
NOAA 12 [-]
NOAA 13 [-]
NOAA 14 [-]
NOAA 15 [B]
NOAA 16 [-]
NOAA 17 [-]
NOAA 18 [B]
NOAA 19 [+]
NPP [+]
...@@ -35,7 +35,7 @@ import predict4java.*; ...@@ -35,7 +35,7 @@ import predict4java.*;
public class SatelliteDB { public class SatelliteDB {
ArrayList<SatelliteTrack> satelliteDB = new ArrayList<SatelliteTrack>(); ArrayList<SatelliteTrack> database = new ArrayList<SatelliteTrack>();
boolean databaseSet = false; boolean databaseSet = false;
String name = "SatelliteDB"; String name = "SatelliteDB";
GroundStationPosition groundstation; GroundStationPosition groundstation;
...@@ -65,13 +65,22 @@ public class SatelliteDB { ...@@ -65,13 +65,22 @@ public class SatelliteDB {
String inputLine; String inputLine;
System.out.println("Data from: " + url); System.out.println("Data from: " + url);
while ((inputLine = in.readLine()) != null){ while ((inputLine = in.readLine()) != null){
String line1 = in.readLine(); String line1 = in.readLine();
String line2 = in.readLine(); String line2 = in.readLine();
String[] args1 = {inputLine,line1,line2}; String[] args1 = {inputLine,line1,line2};
System.out.println(args1[0]);
if(satExist(args1[0])){
System.out.println(inputLine + " updated!");
int num = getSatIndex(inputLine);
database.get(num).setTLE(args1);
}else{
System.out.println(args1[0] + " created!");
SatelliteTrack sat = new SatelliteTrack(args1); SatelliteTrack sat = new SatelliteTrack(args1);
sat.setConstillation(file); sat.setConstillation(file);
satelliteDB.add(sat); database.add(sat);
}
} }
in.close(); in.close();
return true; return true;
...@@ -112,7 +121,7 @@ public class SatelliteDB { ...@@ -112,7 +121,7 @@ public class SatelliteDB {
// } // }
String[] TLEs = {line,br.readLine(),br.readLine()}; String[] TLEs = {line,br.readLine(),br.readLine()};
TLE data = new TLE(TLEs); TLE data = new TLE(TLEs);
//satelliteDB.add(SatelliteFactory.createSatellite(data)); //database.add(SatelliteFactory.createSatellite(data));
// System.out.println(line); // System.out.println(line);
// System.out.println(br.readLine()); // System.out.println(br.readLine());
// System.out.println(br.readLine()); // System.out.println(br.readLine());
...@@ -148,8 +157,9 @@ public class SatelliteDB { ...@@ -148,8 +157,9 @@ public class SatelliteDB {
public int getSatIndex(String sat){ public int getSatIndex(String sat){
for(int i=0;i<satelliteDB.size();i++){ for(int i=0;i<database.size();i++){
if(sat.equals(satelliteDB.get(i).getTLE().getName())){ sat = sat.trim();
if(sat.equals(database.get(i).getTLE().getName())){
return i; return i;
} }
} }
...@@ -159,20 +169,16 @@ public class SatelliteDB { ...@@ -159,20 +169,16 @@ public class SatelliteDB {
} }
public int getSize(){ public int getSize(){
return satelliteDB.size(); return database.size();
} }
// public Satellite getSat(int selectedSatellite) {
// return satelliteDB.get(selectedSatellite);
// }
public boolean satExist(String string){ public boolean satExist(String string){
int selectedSatellite = this.getSatIndex(string); int selectedSatellite = getSatIndex(string);
if(selectedSatellite>=0){ if(selectedSatellite>=0){
//System.out.println(this.getSat(selectedSatellite).getTLE().getName() + " Exists!"); //System.out.println(this.getSat(selectedSatellite).getTLE().getName() + " Exists!");
return true; return true;
}else{ }else{
//System.out.println("Satellite does not exisit");
return false; return false;
} }
} }
...@@ -190,50 +196,50 @@ public class SatelliteDB { ...@@ -190,50 +196,50 @@ public class SatelliteDB {
date.appendChild(doc.createTextNode(new Date().toString())); date.appendChild(doc.createTextNode(new Date().toString()));
rootElement.appendChild(date); rootElement.appendChild(date);
for(int i = 0;i<satelliteDB.size();i++){ for(int i = 0;i<database.size();i++){
Element satellite = doc.createElement("Satellite"); Element satellite = doc.createElement("Satellite");
//satellite.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE().getName())); //satellite.appendChild(doc.createTextNode(database.get(i).getTLE().getName()));
Element name = doc.createElement("name"); Element name = doc.createElement("name");
name.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE().getName())); name.appendChild(doc.createTextNode(database.get(i).getTLE().getName()));
satellite.appendChild(name); satellite.appendChild(name);
Element tle1 = doc.createElement("TLE1"); Element tle1 = doc.createElement("TLE1");
tle1.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE1())); tle1.appendChild(doc.createTextNode(database.get(i).getTLE1()));
satellite.appendChild(tle1); satellite.appendChild(tle1);
Element tle2 = doc.createElement("TLE2"); Element tle2 = doc.createElement("TLE2");
tle2.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE2())); tle2.appendChild(doc.createTextNode(database.get(i).getTLE2()));
satellite.appendChild(tle2); satellite.appendChild(tle2);
//Uplink Frequency used //Uplink Frequency used
Element uFreq = doc.createElement("UplinkFreq"); Element uFreq = doc.createElement("UplinkFreq");
uFreq.appendChild(doc.createTextNode(Long.toString(satelliteDB.get(i).getUplinkFreq()))); uFreq.appendChild(doc.createTextNode(Long.toString(database.get(i).getUplinkFreq())));
satellite.appendChild(uFreq); satellite.appendChild(uFreq);
//Downlink Frequency //Downlink Frequency
Element dFreq = doc.createElement("DownlinkFreq"); Element dFreq = doc.createElement("DownlinkFreq");
dFreq.appendChild(doc.createTextNode(Long.toString(satelliteDB.get(i).getDownlinkFreq()))); dFreq.appendChild(doc.createTextNode(Long.toString(database.get(i).getDownlinkFreq())));
satellite.appendChild(dFreq); satellite.appendChild(dFreq);
//GUI Visible? //GUI Visible?
Element guiVisible = doc.createElement("GUIVisible"); Element guiVisible = doc.createElement("GUIVisible");
guiVisible.appendChild(doc.createTextNode(satelliteDB.get(i).isVisibleGUI().toString())); guiVisible.appendChild(doc.createTextNode(database.get(i).isVisibleGUI().toString()));
satellite.appendChild(guiVisible); satellite.appendChild(guiVisible);
//Image //Image
Element satImage = doc.createElement("satImage"); Element satImage = doc.createElement("satImage");
satImage.appendChild(doc.createTextNode(satelliteDB.get(i).getImage())); satImage.appendChild(doc.createTextNode(database.get(i).getImage()));
satellite.appendChild(satImage); satellite.appendChild(satImage);
//TrackColor //TrackColor
Element trackColor = doc.createElement("trackColor"); Element trackColor = doc.createElement("trackColor");
trackColor.appendChild(doc.createTextNode(satelliteDB.get(i).getTrackColor())); trackColor.appendChild(doc.createTextNode(database.get(i).getTrackColor()));
satellite.appendChild(trackColor); satellite.appendChild(trackColor);
//Constellation //Constellation
Element constellation = doc.createElement("constellation"); Element constellation = doc.createElement("constellation");
constellation.appendChild(doc.createTextNode(satelliteDB.get(i).getConstillation())); constellation.appendChild(doc.createTextNode(database.get(i).getConstillation()));
satellite.appendChild(constellation); satellite.appendChild(constellation);
rootElement.appendChild(satellite); rootElement.appendChild(satellite);
...@@ -292,7 +298,7 @@ public class SatelliteDB { ...@@ -292,7 +298,7 @@ public class SatelliteDB {
String dFreq = eElement.getElementsByTagName("DownlinkFreq").item(0).getTextContent(); String dFreq = eElement.getElementsByTagName("DownlinkFreq").item(0).getTextContent();
String trackColor = eElement.getElementsByTagName("trackColor").item(0).getTextContent(); String trackColor = eElement.getElementsByTagName("trackColor").item(0).getTextContent();
String constellation = eElement.getElementsByTagName("constellation").item(0).getTextContent(); String constellation = eElement.getElementsByTagName("constellation").item(0).getTextContent();
String image = eElement.getElementsByTagName("image").item(0).getTextContent(); String image = eElement.getElementsByTagName("satImage").item(0).getTextContent();
String guiVisible = eElement.getElementsByTagName("GUIVisible").item(0).getTextContent(); String guiVisible = eElement.getElementsByTagName("GUIVisible").item(0).getTextContent();
System.out.println(name); System.out.println(name);
...@@ -309,7 +315,7 @@ public class SatelliteDB { ...@@ -309,7 +315,7 @@ public class SatelliteDB {
sat.setConstillation(constellation); sat.setConstillation(constellation);
sat.setImage(image); sat.setImage(image);
sat.setVisibleGUI(Boolean.valueOf(guiVisible)); sat.setVisibleGUI(Boolean.valueOf(guiVisible));
satelliteDB.add(sat); database.add(sat);
//Debug print out //Debug print out
System.out.println("Satellite name : " + sat.getTLE().getName()); System.out.println("Satellite name : " + sat.getTLE().getName());
......
...@@ -6,7 +6,7 @@ public class tracker { ...@@ -6,7 +6,7 @@ public class tracker {
SatelliteDB satellites = new SatelliteDB("SatelliteDB"); SatelliteDB satellites = new SatelliteDB("SatelliteDB");
//satellites.readXML(); satellites.readXML();
if(satellites.satExist("PROGRESS-M 29M")){ if(satellites.satExist("PROGRESS-M 29M")){
System.out.println("Satellite Exitis!"); System.out.println("Satellite Exitis!");
......
ISS (ZARYA)
TIANGONG 1
SPINSAT
FLOCK 1B-27
FLOCK 1B-21
FLOCK 1B-22
FLOCK 1D-1
FLOCK 1D-2
FLOCK 1B-6
GEARRS-1
PROGRESS-M 28M
FLOCK 1E-2
FLOCK 1E-1
FLOCK 1E-4
FLOCK 1E-3
FLOCK 1E-7
FLOCK 1E-8
FLOCK 1E-5
FLOCK 1E-6
FLOCK 1E-9
FLOCK 1E-10
FLOCK 1E-11
FLOCK 1E-12
FLOCK 1E-13
FLOCK 1E-14
ARKYD-3R
CENTENNIAL 1
SOYUZ-TMA 17M
SOYUZ-TMA 18M
SERPENS
S-CUBE
PROGRESS-M 29M
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment