use of org.orekit.frames.FactoryManagedFrame in project Orekit by CS-SI.
the class OEMParserTest method testParseOemMissingOptionalData.
@Test
public void testParseOemMissingOptionalData() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample6.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile file = parser.parse(inEntry);
Assert.assertEquals(CcsdsTimeScale.UTC, file.getEphemeridesBlocks().get(0).getMetaData().getTimeSystem());
Assert.assertEquals("MARS GLOBAL SURVEYOR", file.getEphemeridesBlocks().get(0).getMetaData().getObjectName());
Assert.assertEquals("1996-062A", file.getEphemeridesBlocks().get(0).getMetaData().getObjectID());
Assert.assertEquals(1, file.getSatellites().size());
Assert.assertEquals(true, file.getSatellites().containsKey("1996-062A"));
Assert.assertEquals(false, file.getSatellites().containsKey("MARS GLOBAL SURVEYOR"));
Assert.assertEquals(1, file.getSatellites().size());
Assert.assertEquals("1996-062A", file.getSatellites().values().iterator().next().getId());
Assert.assertEquals(new AbsoluteDate("2002-12-18T12:00:00.331", TimeScalesFactory.getUTC()), file.getEphemeridesBlocks().get(0).getStartTime());
OemSatelliteEphemeris satellite = file.getSatellites().get("1996-062A");
Assert.assertEquals(satellite.getId(), "1996-062A");
Assert.assertEquals(satellite.getMu(), file.getMuUsed(), 0);
EphemeridesBlock actualBlock = satellite.getSegments().get(0);
Assert.assertEquals(actualBlock.getMu(), file.getMuUsed(), 0);
FactoryManagedFrame eme2000 = FramesFactory.getEME2000();
Frame actualFrame = actualBlock.getFrame();
AbsoluteDate actualStart = satellite.getStart();
Transform actualTransform = eme2000.getTransformTo(actualFrame, actualStart);
CelestialBody mars = CelestialBodyFactory.getMars();
TimeStampedPVCoordinates marsPV = mars.getPVCoordinates(actualStart, eme2000);
Assert.assertEquals(actualTransform.getTranslation(), marsPV.getPosition());
Assert.assertEquals(actualTransform.getVelocity(), marsPV.getVelocity());
Assert.assertEquals(actualTransform.getAcceleration(), marsPV.getAcceleration());
Assert.assertEquals(Rotation.distance(actualTransform.getRotation(), Rotation.IDENTITY), 0.0, 0.0);
Assert.assertEquals(actualTransform.getRotationRate(), Vector3D.ZERO);
Assert.assertEquals(actualTransform.getRotationAcceleration(), Vector3D.ZERO);
Assert.assertEquals(actualFrame.getName(), "Mars/EME2000");
Assert.assertEquals(actualBlock.getFrameString(), "EME2000");
Assert.assertEquals(actualBlock.getTimeScaleString(), "UTC");
Assert.assertEquals(actualBlock.getTimeScale(), TimeScalesFactory.getUTC());
Assert.assertEquals(actualBlock.getAvailableDerivatives(), CartesianDerivativesFilter.USE_PV);
Assert.assertEquals(satellite.getSegments().get(0).getStartTime(), actualStart);
Assert.assertEquals(satellite.getSegments().get(2).getStopTime(), satellite.getStop());
final BoundedPropagator propagator = satellite.getPropagator();
Assert.assertEquals(propagator.getMinDate(), satellite.getStart());
Assert.assertEquals(propagator.getMinDate(), satellite.getSegments().get(0).getStart());
Assert.assertEquals(propagator.getMaxDate(), satellite.getStop());
Assert.assertEquals(propagator.getMaxDate(), satellite.getSegments().get(2).getStop());
final List<TimeStampedPVCoordinates> dataLines = new ArrayList<>();
for (EphemeridesBlock block : file.getEphemeridesBlocks()) {
for (TimeStampedPVCoordinates dataLine : block.getEphemeridesDataLines()) {
if (dataLine.getDate().compareTo(satellite.getStart()) >= 0) {
dataLines.add(dataLine);
}
}
}
final int ulps = 12;
for (TimeStampedPVCoordinates coord : dataLines) {
Assert.assertThat(propagator.getPVCoordinates(coord.getDate(), actualFrame), OrekitMatchers.pvCloseTo(coord, ulps));
Assert.assertThat(propagator.propagate(coord.getDate()).getPVCoordinates(), OrekitMatchers.pvCloseTo(coord, ulps));
}
}
use of org.orekit.frames.FactoryManagedFrame in project Orekit by CS-SI.
the class OrekitStepHandlerTest method testForwardBackwardStep.
@Test
public void testForwardBackwardStep() throws OrekitException, InterruptedException, ExecutionException {
final AbsoluteDate initialDate = new AbsoluteDate(2014, 01, 01, 00, 00, 00.000, TimeScalesFactory.getUTC());
final double mu = CelestialBodyFactory.getEarth().getGM();
FactoryManagedFrame inertialFrame = FramesFactory.getEME2000();
// seconds
final double propagationTime = 7200.0;
// seconds
final double fixedStepSize = 3600;
// meters
final double semimajorAxis = 8000e3;
// unitless
final double eccentricity = 0.001;
final double inclination = FastMath.toRadians(15.0);
final double argPerigee = FastMath.toRadians(10.0);
final double raan = FastMath.toRadians(45.0);
final double trueAnomaly = FastMath.toRadians(10.0);
KeplerianOrbit initialOrbit = new KeplerianOrbit(semimajorAxis, eccentricity, inclination, argPerigee, raan, trueAnomaly, PositionAngle.TRUE, inertialFrame, initialDate, mu);
final Propagator kepler = new KeplerianPropagator(initialOrbit);
kepler.setMasterMode(fixedStepSize, new OrekitFixedStepHandler() {
@Override
public void handleStep(SpacecraftState currentState, boolean isLast) {
}
});
kepler.propagate(initialDate.shiftedBy(propagationTime));
final double stepSizeInSeconds = 120;
final long longestWaitTimeMS = 20;
ExecutorService service = Executors.newSingleThreadExecutor();
for (double elapsedTime = 0; elapsedTime <= propagationTime; elapsedTime += stepSizeInSeconds) {
final double dt = elapsedTime;
Future<SpacecraftState> stateFuture = service.submit(new Callable<SpacecraftState>() {
public SpacecraftState call() throws OrekitException {
return kepler.propagate(initialDate.shiftedBy(dt));
}
});
Thread.sleep(longestWaitTimeMS);
assertTrue(stateFuture.isDone());
SpacecraftState finalState = stateFuture.get();
assertNotNull(finalState);
}
}
Aggregations