Maxime,
This is a runnable code that reads a TLE and list of coordinates/areas and outputs start+end times for windows of visibility. Excluding the orekit initialization for simplicity. Below it are the contents of the .txt files, copy exactly into Notepad or some other similar software. Each type (i.e. TLE, station, and areas) into its own .txt file.
// Earth and frame
final Frame inertialFrame = FramesFactory.getEME2000();
final Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING, earthFrame);
// define sat properties
List<String> target_sat = Files.readAllLines(Paths.get("src/main/java/Test_TLE.txt"));
String tle_line1 = target_sat.get(1);
String tle_line2 = target_sat.get(2);
TLE my_TLE = new TLE(tle_line1, tle_line2);
int halfFOV = 80;
FieldOfView fov = new CircularFieldOfView(Vector3D.PLUS_K, FastMath.toRadians(halfFOV), 0);
// load target coordinates
List<String> target_stations = Files.readAllLines(Paths.get("src/main/java/Test_GS.txt"));
// create station 1
double latitude_1 = FastMath.toRadians(Double.parseDouble(target_stations.get(1)));
double longitude_1 = FastMath.toRadians(Double.parseDouble(target_stations.get(2)));
double altitude_1 = Double.parseDouble(target_stations.get(3));
double elevation_1 = FastMath.toRadians(Double.parseDouble(target_stations.get(4)));
String name_station_1 = target_stations.get(5);
GeodeticPoint station_geodetic_1 = new GeodeticPoint(latitude_1, longitude_1, altitude_1);
TopocentricFrame stationFrame_1 = new TopocentricFrame(earth, station_geodetic_1, name_station_1);
// create station 2
double latitude_2 = FastMath.toRadians(Double.parseDouble(target_stations.get(8)));
double longitude_2 = FastMath.toRadians(Double.parseDouble(target_stations.get(9)));
double altitude_2 = Double.parseDouble(target_stations.get(10));
double elevation_2 = FastMath.toRadians(Double.parseDouble(target_stations.get(11)));
String name_station_2 = target_stations.get(12);
GeodeticPoint station_geodetic_2 = new GeodeticPoint(latitude_2, longitude_2, altitude_2);
TopocentricFrame stationFrame_2 = new TopocentricFrame(earth, station_geodetic_2, name_station_2);
// load target areas
List<String> target_areas = Files.readAllLines(Paths.get("src/main/java/Test_TA.txt"));
// create area 1
S2Point[] vertice_points_1 = new S2Point[4];
GeodeticPoint vertice = new GeodeticPoint(FastMath.toRadians(Double.parseDouble(target_areas.get(0))), FastMath.toRadians(Double.parseDouble(target_areas.get(1))), Double.parseDouble(target_areas.get(2)));
Vector3D vertice_3d = earth.transform(vertice);
vertice_points_1[0] = new S2Point(vertice_3d);
vertice = new GeodeticPoint(FastMath.toRadians(Double.parseDouble(target_areas.get(3))), FastMath.toRadians(Double.parseDouble(target_areas.get(4))), Double.parseDouble(target_areas.get(5)));
vertice_3d = earth.transform(vertice);
vertice_points_1[1] = new S2Point(vertice_3d);
vertice = new GeodeticPoint(FastMath.toRadians(Double.parseDouble(target_areas.get(6))), FastMath.toRadians(Double.parseDouble(target_areas.get(7))), Double.parseDouble(target_areas.get(8)));
vertice_3d = earth.transform(vertice);
vertice_points_1[2] = new S2Point(vertice_3d);
vertice = new GeodeticPoint(FastMath.toRadians(Double.parseDouble(target_areas.get(9))), FastMath.toRadians(Double.parseDouble(target_areas.get(10))), Double.parseDouble(target_areas.get(11)));
vertice_3d = earth.transform(vertice);
vertice_points_1[3] = new S2Point(vertice_3d);
SphericalPolygonsSet target_area_1 = new SphericalPolygonsSet(0.0001 , vertice_points_1);
// Propagation Characteristics
AbsoluteDate start_date = my_TLE.getDate(); // Propagation starts from date of most recent TLE (Orekit)
final double stepT = 60.; // step size of 1 minute for propagation
AbsoluteDate final_date = start_date.shiftedBy(24*3600); // 1 day
TLEPropagator Prop = TLEPropagator.selectExtrapolator(my_TLE);
Prop.clearEventsDetectors();
// set detectors
final double maxcheck = 60; // Checking every x second
final double threshold = 0.001; //Convergence to 0.001 seconds
final FieldOfViewDetector fd_1 = new FieldOfViewDetector(stationFrame_1, fov);
final FieldOfViewDetector fd_2 = new FieldOfViewDetector(stationFrame_2, fov);
final ElevationDetector ed_1 = new ElevationDetector(stationFrame_1).withConstantElevation(elevation_1);
final ElevationDetector ed_2 = new ElevationDetector(stationFrame_2).withConstantElevation(elevation_2);
// create detector station 1
final EventDetector stationVisibility_1 = BooleanDetector.andCombine(ed_1, BooleanDetector.notCombine(fd_1)).
withMaxCheck(maxcheck).withThreshold(threshold).
withHandler((s, detector, increasing) -> {
if (increasing) {
System.out.println("STATION 1 EVENT");
System.out.println("ENTERING: "+s.getDate());
} else {
System.out.println("STATION 1 EVENT");
System.out.println("LEAVING: "+s.getDate());
}
return increasing ? Action.CONTINUE : Action.STOP;
});
Prop.addEventDetector(stationVisibility_1);
// create detector station 2
final EventDetector stationVisibility_2 = BooleanDetector.andCombine(ed_2, BooleanDetector.notCombine(fd_2)).
withMaxCheck(maxcheck).withThreshold(threshold).
withHandler((s, detector, increasing) -> {
if (increasing) {
System.out.println("STATION 2 EVENT");
System.out.println("ENTERING: "+s.getDate());
} else {
System.out.println("STATION 2 EVENT");
System.out.println("LEAVING: "+s.getDate());
}
return increasing ? Action.CONTINUE : Action.STOP;
});
Prop.addEventDetector(stationVisibility_2);
// create detector area 1
final EventDetector geodetect_1 = new FootprintOverlapDetector(fov, new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame),
target_area_1, 10000).
withMaxCheck(maxcheck).withThreshold(threshold).
withHandler((s, detector, increasing) -> {
if (increasing) {
System.out.println("AREA 1 EVENT");
System.out.println("ENTERING: "+s.getDate());
} else {
System.out.println("AREA 1 EVENT");
System.out.println("LEAVING: "+s.getDate());
}
return increasing ? Action.CONTINUE : Action.STOP;
});
Prop.addEventDetector(geodetect_1);
// propagate satellite
for (AbsoluteDate extrapDate = start_date;
extrapDate.compareTo(final_date) <= 0;
extrapDate = extrapDate.shiftedBy(stepT)) {
TimeStampedPVCoordinates pv = Prop.getPVCoordinates(extrapDate, inertialFrame);
}
}
TLE:
LEMUR-2-SPIRE-MINIONS
1 41992U 17008AW 22318.16144769 .00036410 00000+0 81443-3 0 9991
2 41992 97.2491 22.3236 0005163 55.5360 304.6376 15.43385114319430
STATIONS:
“2”
29.0
-81.0
0.0
20.0
“Florida Ground Station”
“101”
35.32
-91.14
0.0
35.0
“User Equipment 1”
AREA:
40.7128
-74.0060
0.0
41.8781
-87.6298
0.0
29.7604
-95.3698
0.0
30.3322
-81.6557
0.0
The following are the expected windows:
Station 1:
14 Nov 2022 15:23:05.457 - 15:27:15.840
15 Nov 2022 03:18:17.593 - 03:22:14.120
Station 2:
14 Nov 2022 04:00:49.901 - 04:02:06.594
15 Nov 2022 03:21:25.978 - 03:23:09.318
Area 1:
14 Nov 2022 03:54:55.341 - 04:08:03.045
14 Nov 2022 05:31:38.122 - 05:34:28.297
14 Nov 2022 13:45:46.692 - 13:52:15.435
14 Nov 2022 15:16:36.589 - 15:30:06.916
15 Nov 2022 01:45:14.589 - 01:55:43.149
15 Nov 2022 03:15:24.194 - 03:29:05.599
Any help would be greatly appreciated. Thank you in adance.