diff --git a/src/main/java/ru/r2cloud/predict/PredictOreKit.java b/src/main/java/ru/r2cloud/predict/PredictOreKit.java index 95d0cd06..7ccef5cd 100644 --- a/src/main/java/ru/r2cloud/predict/PredictOreKit.java +++ b/src/main/java/ru/r2cloud/predict/PredictOreKit.java @@ -35,7 +35,6 @@ import org.orekit.propagation.events.GroundFieldOfViewDetector; import org.orekit.propagation.events.handlers.ContinueOnEvent; import org.orekit.propagation.events.handlers.EventHandler; -import org.orekit.propagation.events.handlers.StopOnDecreasing; import org.orekit.time.AbsoluteDate; import org.orekit.time.TimeScalesFactory; import org.orekit.utils.Constants; @@ -115,23 +114,6 @@ public List calculateSchedule(AntennaConfiguration antenna, Date curren } } - public SatPass calculateNext(AntennaConfiguration antenna, Date current, TLEPropagator tlePropagator) { - TopocentricFrame baseStationFrame = getPosition(); - if (baseStationFrame == null) { - return null; - } - AbsoluteDate initialDate = new AbsoluteDate(current, TimeScalesFactory.getUTC()); - switch (antenna.getType()) { - case OMNIDIRECTIONAL: - case DIRECTIONAL: - return calculateNextOmnidirectional(antenna, initialDate, baseStationFrame, tlePropagator); - case FIXED_DIRECTIONAL: - return calculateNextFixedDirectional(antenna, initialDate, baseStationFrame, tlePropagator); - default: - throw new IllegalArgumentException("Unexpected value: " + antenna.getType()); - } - } - private static List calculateFixedDirectional(AntennaConfiguration antenna, AbsoluteDate initialDate, TopocentricFrame baseStationFrame, TLEPropagator tlePropagator, @SuppressWarnings("rawtypes") EventHandler handler) { // orekit expects azimuth in counter clock wise degrees double azimuthRadians = FastMath.toRadians(Util.convertAzimuthToDegress(antenna.getAzimuth())); @@ -154,14 +136,6 @@ private static List calculateFixedDirectional(AntennaConfiguration ante return convert(initialDate, logger.getLoggedEvents()); } - private static SatPass calculateNextFixedDirectional(AntennaConfiguration antenna, AbsoluteDate initialDate, TopocentricFrame baseStationFrame, TLEPropagator tlePropagator) { - List result = calculateFixedDirectional(antenna, initialDate, baseStationFrame, tlePropagator, new StopOnDecreasing<>()); - if (result.isEmpty()) { - return null; - } - return result.get(0); - } - private static List calculateOmnidirectional(AntennaConfiguration antenna, AbsoluteDate initialDate, TopocentricFrame baseStationFrame, TLEPropagator tlePropagator) { List result = new ArrayList<>(); List max = new ArrayList<>(); @@ -196,24 +170,6 @@ public Action eventOccurred(SpacecraftState s, ElevationExtremumDetector detecto return result; } - private static SatPass calculateNextOmnidirectional(AntennaConfiguration antenna, AbsoluteDate initialDate, TopocentricFrame baseStationFrame, TLEPropagator tlePropagator) { - MaxElevationHandler maxElevationHandler = new MaxElevationHandler(antenna.getGuaranteedElevation()); - ElevationExtremumDetector maxDetector = new ElevationExtremumDetector(600, 1, baseStationFrame).withMaxIter(48 * 60).withHandler(maxElevationHandler); - tlePropagator.clearEventsDetectors(); - tlePropagator.addEventDetector(new EventSlopeFilter(maxDetector, FilterType.TRIGGER_ONLY_DECREASING_EVENTS)); - try { - tlePropagator.propagate(initialDate, new AbsoluteDate(initialDate, PREDICT_INTERVAL_SECONDS)); - } catch (Exception e) { - LOG.error("unable to calculate next observation. Most likely TLE is stale", e); - return null; - } - if (maxElevationHandler.getDate() == null) { - return null; - } - - return findStartEnd(tlePropagator, baseStationFrame, maxElevationHandler.getDate(), antenna); - } - private static SatPass findStartEnd(TLEPropagator tlePropagator, TopocentricFrame baseStationFrame, AbsoluteDate maxElevationTime, AntennaConfiguration antenna) { MinElevationHandler minElevationHandler = new MinElevationHandler(); ElevationDetector boundsDetector = new ElevationDetector(600, 1, baseStationFrame).withConstantElevation(FastMath.toRadians(antenna.getMinElevation())).withHandler(minElevationHandler); diff --git a/src/main/resources/satellites.json b/src/main/resources/satellites.json index cf0c3141..f26e7f24 100644 --- a/src/main/resources/satellites.json +++ b/src/main/resources/satellites.json @@ -1,4 +1,43 @@ [ + { + "id": "R2CLOUD388", + "name": "GALASSIA-2", + "noradId": "57486", + "enabled": false, + "transmitters": [ + { + "modulation": "GFSK", + "framing": "AX100", + "beaconClass": "ru.r2cloud.jradio.csp.CspBeacon", + "frequency": 436400000, + "bandwidth": 20000, + "baudRates": [ + 1200 + ], + "status": "ENABLED" + } + ] + }, + { + "id": "R2CLOUD387", + "name": "SCOOB-II", + "noradId": "57484", + "enabled": false, + "transmitters": [ + { + "modulation": "GFSK", + "framing": "AX25G3RUH", + "beaconClass": "ru.r2cloud.jradio.ax25.Ax25Beacon", + "frequency": 437500000, + "bandwidth": 20000, + "baudRates": [ + 9600 + ], + "assistedHeader": "AAEAAAEAAAEAAQEAAAEAAQABAAEBAAEAAAEAAAABAQAAAAAAAAABAAAAAAAAAAEAAAAAAAABAQAAAAEAAAAAAQABAQAAAAABAAAAAQABAAEAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQABAAAAAAEBAQEBAAAAAAAAAAAAAAEBAQE=", + "status": "ENABLED" + } + ] + }, { "id": "R2CLOUD385", "name": "MONITOR-2 (RS39S)", @@ -2605,44 +2644,6 @@ } ] }, - { - "id": "R2CLOUD234", - "name": "DIAMOND GREEN", - "noradId": "42785", - "enabled": false, - "transmitters": [ - { - "modulation": "GFSK", - "framing": "AX100", - "beaconClass": "ru.r2cloud.jradio.csp.CspBeacon", - "frequency": 401150000, - "bandwidth": 20000, - "baudRates": [ - 9600 - ], - "status": "ENABLED" - } - ] - }, - { - "id": "R2CLOUD233", - "name": "DIAMOND BLUE", - "noradId": "42786", - "enabled": false, - "transmitters": [ - { - "modulation": "GFSK", - "framing": "AX100", - "beaconClass": "ru.r2cloud.jradio.csp.CspBeacon", - "frequency": 401150000, - "bandwidth": 20000, - "baudRates": [ - 9600 - ], - "status": "ENABLED" - } - ] - }, { "id": "R2CLOUD232", "name": "PTD-3 (TYVAK-0125)", @@ -3309,27 +3310,6 @@ } ] }, - { - "id": "R2CLOUD172", - "name": "MIET-AIS (RS28S)", - "noradId": "53377", - "enabled": true, - "transmitters": [ - { - "modulation": "GFSK", - "framing": "USP", - "beaconClass": "ru.r2cloud.jradio.sputnix.SputnixBeacon", - "frequency": 437900000, - "bandwidth": 20000, - "baudRates": [ - 4800, - 2400, - 9600 - ], - "status": "ENABLED" - } - ] - }, { "id": "R2CLOUD171", "name": "RESHUCUBE (RS8S)", @@ -4277,7 +4257,7 @@ "baudRates": [ 1200 ], - "deviation": -600, + "deviation": -300, "afCarrier": 1500, "status": "ENABLED" } diff --git a/src/test/java/ru/r2cloud/satellite/PredictOreKitTest.java b/src/test/java/ru/r2cloud/satellite/PredictOreKitTest.java index 909482f5..da4f2f5c 100644 --- a/src/test/java/ru/r2cloud/satellite/PredictOreKitTest.java +++ b/src/test/java/ru/r2cloud/satellite/PredictOreKitTest.java @@ -1,7 +1,7 @@ package ru.r2cloud.satellite; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.text.SimpleDateFormat; @@ -34,7 +34,9 @@ public class PredictOreKitTest { @Test public void testMeoOrbit() throws Exception { TLEPropagator astroBio = TLEPropagator.selectExtrapolator(new org.orekit.propagation.analytical.tle.TLE("1 84002U 22194.52504630 .00000000 00000-0 00000-0 0 00", "2 84002 70.1600 50.0000 0000815 30.0000 147.0000 6.38669028 02")); - assertPosition("16:00:57", "16:45:56", predict.calculateNext(antenna, getDate("29-09-2022 14:54:00"), astroBio)); + List result = predict.calculateSchedule(antenna, getDate("29-09-2022 14:54:00"), astroBio); + assertFalse(result.isEmpty()); + assertPosition("16:00:57", "16:45:56", result.get(0)); } @Test @@ -49,15 +51,19 @@ public void testCalculateBatch() throws Exception { public void testPredictWithoutBaseStationCoordinates() throws Exception { config.remove("locaiton.lat"); config.remove("locaiton.lon"); - - assertNull(predict.calculateNext(antenna, getDate("29-09-2017 14:54:00"), noaa15)); + List result = predict.calculateSchedule(antenna, getDate("29-09-2017 14:54:00"), noaa15); + assertTrue(result.isEmpty()); } // expected pass times taken from wxtoimg @Test public void testSameAsWxToImg() throws Exception { - assertPosition("18:05:57", "18:17:12", predict.calculateNext(antenna, getDate("29-09-2017 14:54:00"), noaa15)); - assertPosition("19:46:56", "19:56:34", predict.calculateNext(antenna, getDate("29-09-2017 19:00:00"), noaa15)); + List result = predict.calculateSchedule(antenna, getDate("29-09-2017 14:54:00"), noaa15); + assertFalse(result.isEmpty()); + assertPosition("18:05:57", "18:17:12", result.get(0)); + result = predict.calculateSchedule(antenna, getDate("29-09-2017 19:00:00"), noaa15); + assertFalse(result.isEmpty()); + assertPosition("19:46:56", "19:56:34", result.get(0)); } @Test @@ -68,8 +74,6 @@ public void testFixedDirectionalAntenna() throws Exception { antenna.setElevation(0.0); antenna.setBeamwidth(45); TLEPropagator propagator = TLEPropagator.selectExtrapolator(new org.orekit.propagation.analytical.tle.TLE("1 43881U 18111F 24042.67399199 .00015427 00000+0 10192-2 0 9994", "2 43881 97.6384 310.9432 0012514 108.3312 251.9278 15.07433805280400")); - assertPosition("11:29:31", "11:33:11", predict.calculateNext(antenna, getDate("12-02-2024 11:20:00"), propagator)); - assertPosition("11:30:00", "11:33:11", predict.calculateNext(antenna, getDate("12-02-2024 11:30:00"), propagator)); List schedule = predict.calculateSchedule(antenna, getDate("12-02-2024 11:20:00"), propagator); assertEquals(4, schedule.size()); assertPosition("11:29:31", "11:33:11", schedule.get(0)); @@ -86,20 +90,6 @@ public void testStaleTle() throws Exception { antenna.setGuaranteedElevation(10); List result = predict.calculateSchedule(antenna, getDate("21-07-2024 14:07:37"), createPropagatorForStaleTle()); assertTrue(result.isEmpty()); - assertNull(predict.calculateNext(antenna, getDate("21-07-2024 20:06:37"), createPropagatorForStaleTle())); - } - - // it looks like Orekit has some state, - // calling new propagator with different dates - // cause different exceptions - @Test - public void testStaleTle2() throws Exception { - config.setProperty("locaiton.lat", "51.82"); - config.setProperty("locaiton.lon", "-0.05"); - antenna.setMinElevation(2); - antenna.setGuaranteedElevation(10); - predict.calculateSchedule(antenna, getDate("21-07-2024 00:06:37"), createPropagatorForStaleTle()); - assertNull(predict.calculateNext(antenna, getDate("21-07-2024 20:06:37"), createPropagatorForStaleTle())); } private static Date getDate(String str) throws Exception {