use of org.orekit.propagation.analytical.tle.TLE in project Orekit by CS-SI.
the class TLEConverterTest method checkFit.
protected void checkFit(final TLE tle, final double duration, final double stepSize, final double threshold, final boolean positionOnly, final boolean withBStar, final double expectedRMS) throws OrekitException {
Propagator p = TLEPropagator.selectExtrapolator(tle);
List<SpacecraftState> sample = new ArrayList<SpacecraftState>();
for (double dt = 0; dt < duration; dt += stepSize) {
sample.add(p.propagate(tle.getDate().shiftedBy(dt)));
}
TLEPropagatorBuilder builder = new TLEPropagatorBuilder(tle, PositionAngle.TRUE, 1.0);
List<DelegatingDriver> drivers = builder.getPropagationParametersDrivers().getDrivers();
// there should *not* be any drivers for central attraction coefficient (see issue #313)
Assert.assertEquals(1, drivers.size());
Assert.assertEquals("BSTAR", drivers.get(0).getName());
FiniteDifferencePropagatorConverter fitter = new FiniteDifferencePropagatorConverter(builder, threshold, 1000);
if (withBStar) {
fitter.convert(sample, positionOnly, TLEPropagatorBuilder.B_STAR);
} else {
fitter.convert(sample, positionOnly);
}
TLEPropagator prop = (TLEPropagator) fitter.getAdaptedPropagator();
TLE fitted = prop.getTLE();
Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.001 * expectedRMS);
Assert.assertEquals(tle.getSatelliteNumber(), fitted.getSatelliteNumber());
Assert.assertEquals(tle.getClassification(), fitted.getClassification());
Assert.assertEquals(tle.getLaunchYear(), fitted.getLaunchYear());
Assert.assertEquals(tle.getLaunchNumber(), fitted.getLaunchNumber());
Assert.assertEquals(tle.getLaunchPiece(), fitted.getLaunchPiece());
Assert.assertEquals(tle.getElementNumber(), fitted.getElementNumber());
Assert.assertEquals(tle.getRevolutionNumberAtEpoch(), fitted.getRevolutionNumberAtEpoch());
final double eps = 1.0e-5;
Assert.assertEquals(tle.getMeanMotion(), fitted.getMeanMotion(), eps * tle.getMeanMotion());
Assert.assertEquals(tle.getE(), fitted.getE(), eps * tle.getE());
Assert.assertEquals(tle.getI(), fitted.getI(), eps * tle.getI());
Assert.assertEquals(tle.getPerigeeArgument(), fitted.getPerigeeArgument(), eps * tle.getPerigeeArgument());
Assert.assertEquals(tle.getRaan(), fitted.getRaan(), eps * tle.getRaan());
Assert.assertEquals(tle.getMeanAnomaly(), fitted.getMeanAnomaly(), eps * tle.getMeanAnomaly());
if (withBStar) {
Assert.assertEquals(tle.getBStar(), fitted.getBStar(), eps * tle.getBStar());
}
}
use of org.orekit.propagation.analytical.tle.TLE in project Orekit by CS-SI.
the class TLEConverterTest method setUp.
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
geoTLE = new TLE("1 27508U 02040A 12021.25695307 -.00000113 00000-0 10000-3 0 7326", "2 27508 0.0571 356.7800 0005033 344.4621 218.7816 1.00271798 34501");
leoTLE = new TLE("1 31135U 07013A 11003.00000000 .00000816 00000+0 47577-4 0 11", "2 31135 2.4656 183.9084 0021119 236.4164 60.4567 15.10546832 15");
}
use of org.orekit.propagation.analytical.tle.TLE in project Orekit by CS-SI.
the class IodLambertTest method testMultiRevolutions.
@Test
public void testMultiRevolutions() throws OrekitException {
Utils.setDataRoot("regular-data");
TLE aussatB1 = new TLE("1 22087U 92054A 17084.21270512 -.00000243 +00000-0 +00000-0 0 9999", "2 22087 008.5687 046.5717 0005960 022.3650 173.1619 00.99207999101265");
final Propagator propagator = TLEPropagator.selectExtrapolator(aussatB1);
final Frame teme = FramesFactory.getTEME();
final AbsoluteDate t1 = new AbsoluteDate("2017-03-25T23:48:31.282", TimeScalesFactory.getUTC());
final Vector3D p1 = propagator.propagate(t1).getPVCoordinates(teme).getPosition();
final AbsoluteDate t2 = t1.shiftedBy(40000);
final Vector3D p2 = propagator.propagate(t2).getPVCoordinates(teme).getPosition();
final AbsoluteDate t3 = t1.shiftedBy(115200.0);
final Vector3D p3 = propagator.propagate(t3).getPVCoordinates(teme).getPosition();
IodLambert lambert = new IodLambert(Constants.WGS84_EARTH_MU);
KeplerianOrbit k0 = lambert.estimate(teme, true, 0, p1, t1, p2, t2);
Assert.assertEquals(6.08e-4, k0.getE(), 1.0e-6);
Assert.assertEquals(8.55, FastMath.toDegrees(k0.getI()), 0.01);
Assert.assertEquals(0.0, Vector3D.distance(p1, k0.getPVCoordinates(t1, teme).getPosition()), 2.0e-8);
Assert.assertEquals(0.0, Vector3D.distance(p2, k0.getPVCoordinates(t2, teme).getPosition()), 2.0e-7);
KeplerianOrbit k1 = lambert.estimate(teme, false, 1, p1, t1, p3, t3);
Assert.assertEquals(5.97e-4, k1.getE(), 1.0e-6);
Assert.assertEquals(8.55, FastMath.toDegrees(k1.getI()), 0.01);
Assert.assertEquals(0.0, Vector3D.distance(p1, k1.getPVCoordinates(t1, teme).getPosition()), 7.0e-9);
Assert.assertEquals(0.0, Vector3D.distance(p3, k1.getPVCoordinates(t3, teme).getPosition()), 3.0e-7);
}
use of org.orekit.propagation.analytical.tle.TLE in project Orekit by CS-SI.
the class DOPComputerTest method testNotEnoughSV.
@Test(expected = OrekitException.class)
public void testNotEnoughSV() throws OrekitException {
// Get the TLEs for 3 SV from the GPS constellation ...
List<Propagator> gps = new ArrayList<Propagator>();
gps.add(TLEPropagator.selectExtrapolator(new TLE("1 24876U 97035A 16084.84459975 -.00000010 00000-0 00000-0 0 9993", "2 24876 55.6874 244.8168 0043829 115.0986 245.3138 2.00562757137015")));
gps.add(TLEPropagator.selectExtrapolator(new TLE("1 25933U 99055A 16085.52437157 -.00000002 00000-0 00000+0 0 9996", "2 25933 51.3408 97.3364 0160004 86.4308 330.0871 2.00564826120645")));
gps.add(TLEPropagator.selectExtrapolator(new TLE("1 26360U 00025A 16085.38640501 .00000003 00000-0 00000+0 0 9993", "2 26360 53.0703 173.6078 0045232 76.6879 342.6592 2.00558759116334")));
// Creates the computer
final DOPComputer computer = DOPComputer.create(earth, location);
// Defines the computation date
final AbsoluteDate date = new AbsoluteDate(2016, 3, 27, 12, 0, 0., TimeScalesFactory.getUTC());
// Computes the DOP with all the SV from the GPS constellation
computer.compute(date, gps);
}
use of org.orekit.propagation.analytical.tle.TLE in project Orekit by CS-SI.
the class OrbitDetermination method createOrbit.
/**
* Create an orbit from input parameters
* @param parser input file parser
* @param mu central attraction coefficient
* @throws NoSuchElementException if input parameters are missing
* @throws OrekitException if inertial frame cannot be created
*/
private Orbit createOrbit(final KeyValueFileParser<ParameterKey> parser, final double mu) throws NoSuchElementException, OrekitException {
final Frame frame;
if (!parser.containsKey(ParameterKey.INERTIAL_FRAME)) {
frame = FramesFactory.getEME2000();
} else {
frame = parser.getInertialFrame(ParameterKey.INERTIAL_FRAME);
}
// Orbit definition
PositionAngle angleType = PositionAngle.MEAN;
if (parser.containsKey(ParameterKey.ORBIT_ANGLE_TYPE)) {
angleType = PositionAngle.valueOf(parser.getString(ParameterKey.ORBIT_ANGLE_TYPE).toUpperCase());
}
if (parser.containsKey(ParameterKey.ORBIT_KEPLERIAN_A)) {
return new KeplerianOrbit(parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_A), parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_E), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_I), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_PA), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_RAAN), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_ANOMALY), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
} else if (parser.containsKey(ParameterKey.ORBIT_EQUINOCTIAL_A)) {
return new EquinoctialOrbit(parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_A), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EY), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HY), parser.getAngle(ParameterKey.ORBIT_EQUINOCTIAL_LAMBDA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
} else if (parser.containsKey(ParameterKey.ORBIT_CIRCULAR_A)) {
return new CircularOrbit(parser.getDouble(ParameterKey.ORBIT_CIRCULAR_A), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EX), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EY), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_I), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_RAAN), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_ALPHA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
} else if (parser.containsKey(ParameterKey.ORBIT_TLE_LINE_1)) {
final String line1 = parser.getString(ParameterKey.ORBIT_TLE_LINE_1);
final String line2 = parser.getString(ParameterKey.ORBIT_TLE_LINE_2);
final TLE tle = new TLE(line1, line2);
TLEPropagator propagator = TLEPropagator.selectExtrapolator(tle);
// propagator.setEphemerisMode();
AbsoluteDate initDate = tle.getDate();
SpacecraftState initialState = propagator.getInitialState();
// Transformation from TEME to frame.
return new CartesianOrbit(initialState.getPVCoordinates(FramesFactory.getEME2000()), frame, initDate, mu);
} else {
final double[] pos = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PX), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PY), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PZ) };
final double[] vel = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VX), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VY), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VZ) };
return new CartesianOrbit(new PVCoordinates(new Vector3D(pos), new Vector3D(vel)), frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
}
}
Aggregations