-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMultiSatelliteTracking.java
More file actions
92 lines (77 loc) · 4.01 KB
/
Copy pathMultiSatelliteTracking.java
File metadata and controls
92 lines (77 loc) · 4.01 KB
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
import uk.me.g4dpz.satellite.GroundStationPosition;
import uk.me.g4dpz.satellite.PassPredictor;
import uk.me.g4dpz.satellite.SatPos;
import uk.me.g4dpz.satellite.TLE;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Example showing how to track multiple satellites simultaneously.
*/
public class MultiSatelliteTracking {
public static void main(String[] args) {
try {
// Define multiple satellites with their TLE data
Map<String, String[]> satellites = new HashMap<>();
// ISS
satellites.put("ISS", new String[]{
"ISS (ZARYA)",
"1 25544U 98067A 26243.14365400 .00005331 00000+0 10505-3 0 9995",
"2 25544 51.6314 289.0986 0005054 92.1995 267.9572 15.48946173583375"
});
// Hubble Space Telescope
satellites.put("HST", new String[]{
"HST",
"1 20580U 90037B 26242.83844338 .00005591 00000+0 17102-3 0 9994",
"2 20580 28.4726 290.0642 0001561 244.0475 115.9960 15.31512856800026"
});
// NOAA 19 (Weather satellite)
satellites.put("NOAA-20", new String[]{
"NOAA 20 (JPSS-1)",
"1 43013U 17073A 26243.13949125 .00000039 00000+0 39569-4 0 9997",
"2 43013 98.7796 181.9439 0001907 67.8872 292.2507 14.19523597455107"
});
// Ground station: G4DPZ
GroundStationPosition groundStation = new GroundStationPosition(
52.4670, // G4DPZ latitude
-2.0220, // G4DPZ longitude
200.0 // Altitude (meters)
);
Date now = new Date();
System.out.println("Multi-Satellite Tracking");
System.out.println("Ground Station: G4DPZ");
System.out.println("Time: " + now);
System.out.println("=====================================\n");
// Track each satellite
for (Map.Entry<String, String[]> entry : satellites.entrySet()) {
String satName = entry.getKey();
String[] tleLine = entry.getValue();
try {
TLE tle = new TLE(tleLine);
PassPredictor predictor = new PassPredictor(tle, groundStation);
List<SatPos> positions = predictor.getPositions(now, 60, 0, 1);
SatPos position = positions.get(0);
System.out.println(satName + ":");
System.out.println(" Latitude: " + String.format("%7.3f°", Math.toDegrees(position.getLatitude())));
System.out.println(" Longitude: " + String.format("%7.3f°", Math.toDegrees(position.getLongitude())));
System.out.println(" Altitude: " + String.format("%7.1f km", position.getAltitude()));
System.out.println(" Azimuth: " + String.format("%7.2f°", Math.toDegrees(position.getAzimuth())));
System.out.println(" Elevation: " + String.format("%7.2f°", Math.toDegrees(position.getElevation())));
System.out.println(" Range: " + String.format("%7.1f km", position.getRange()));
if (position.getElevation() > 0) {
System.out.println(" Status: ✓ VISIBLE");
} else {
System.out.println(" Status: ✗ Below horizon");
}
System.out.println();
} catch (Exception e) {
System.out.println(satName + ": Error - " + e.getMessage() + "\n");
}
}
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}
}