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.*;
public class SatelliteDB {
ArrayList<SatelliteTrack> satelliteDB = new ArrayList<SatelliteTrack>();
ArrayList<SatelliteTrack> database = new ArrayList<SatelliteTrack>();
boolean databaseSet = false;
String name = "SatelliteDB";
GroundStationPosition groundstation;
......@@ -65,13 +65,22 @@ public class SatelliteDB {
String inputLine;
System.out.println("Data from: " + url);
while ((inputLine = in.readLine()) != null){
String line1 = in.readLine();
String line2 = in.readLine();
String[] args1 = {inputLine,line1,line2};
System.out.println(args1[0]);
SatelliteTrack sat = new SatelliteTrack(args1);
sat.setConstillation(file);
satelliteDB.add(sat);
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);
sat.setConstillation(file);
database.add(sat);
}
}
in.close();
return true;
......@@ -112,7 +121,7 @@ public class SatelliteDB {
// }
String[] TLEs = {line,br.readLine(),br.readLine()};
TLE data = new TLE(TLEs);
//satelliteDB.add(SatelliteFactory.createSatellite(data));
//database.add(SatelliteFactory.createSatellite(data));
// System.out.println(line);
// System.out.println(br.readLine());
// System.out.println(br.readLine());
......@@ -148,8 +157,9 @@ public class SatelliteDB {
public int getSatIndex(String sat){
for(int i=0;i<satelliteDB.size();i++){
if(sat.equals(satelliteDB.get(i).getTLE().getName())){
for(int i=0;i<database.size();i++){
sat = sat.trim();
if(sat.equals(database.get(i).getTLE().getName())){
return i;
}
}
......@@ -159,20 +169,16 @@ public class SatelliteDB {
}
public int getSize(){
return satelliteDB.size();
return database.size();
}
// public Satellite getSat(int selectedSatellite) {
// return satelliteDB.get(selectedSatellite);
// }
public boolean satExist(String string){
int selectedSatellite = this.getSatIndex(string);
int selectedSatellite = getSatIndex(string);
if(selectedSatellite>=0){
//System.out.println(this.getSat(selectedSatellite).getTLE().getName() + " Exists!");
return true;
}else{
//System.out.println("Satellite does not exisit");
return false;
}
}
......@@ -190,50 +196,50 @@ public class SatelliteDB {
date.appendChild(doc.createTextNode(new Date().toString()));
rootElement.appendChild(date);
for(int i = 0;i<satelliteDB.size();i++){
for(int i = 0;i<database.size();i++){
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");
name.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE().getName()));
name.appendChild(doc.createTextNode(database.get(i).getTLE().getName()));
satellite.appendChild(name);
Element tle1 = doc.createElement("TLE1");
tle1.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE1()));
tle1.appendChild(doc.createTextNode(database.get(i).getTLE1()));
satellite.appendChild(tle1);
Element tle2 = doc.createElement("TLE2");
tle2.appendChild(doc.createTextNode(satelliteDB.get(i).getTLE2()));
tle2.appendChild(doc.createTextNode(database.get(i).getTLE2()));
satellite.appendChild(tle2);
//Uplink Frequency used
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);
//Downlink Frequency
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);
//GUI Visible?
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);
//Image
Element satImage = doc.createElement("satImage");
satImage.appendChild(doc.createTextNode(satelliteDB.get(i).getImage()));
satImage.appendChild(doc.createTextNode(database.get(i).getImage()));
satellite.appendChild(satImage);
//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);
//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);
rootElement.appendChild(satellite);
......@@ -292,7 +298,7 @@ public class SatelliteDB {
String dFreq = eElement.getElementsByTagName("DownlinkFreq").item(0).getTextContent();
String trackColor = eElement.getElementsByTagName("trackColor").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();
System.out.println(name);
......@@ -309,7 +315,7 @@ public class SatelliteDB {
sat.setConstillation(constellation);
sat.setImage(image);
sat.setVisibleGUI(Boolean.valueOf(guiVisible));
satelliteDB.add(sat);
database.add(sat);
//Debug print out
System.out.println("Satellite name : " + sat.getTLE().getName());
......
......@@ -6,7 +6,7 @@ public class tracker {
SatelliteDB satellites = new SatelliteDB("SatelliteDB");
//satellites.readXML();
satellites.readXML();
if(satellites.satExist("PROGRESS-M 29M")){
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