Search in sources :

Example 96 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class FiniteDifferencePropagatorConverterTest method testGetObjectiveFunctionParametersOnlyScaledOnce.

/**
 * Test case for bug #362. Check that scaling is only applied once.
 *
 * @throws OrekitException on error.
 */
@Test
public void testGetObjectiveFunctionParametersOnlyScaledOnce() throws OrekitException {
    // setup
    // create some arbitrary sample data to run with
    Frame eci = FramesFactory.getGCRF();
    double gm = Constants.EIGEN5C_EARTH_MU;
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Propagator source = new KeplerianPropagator(new KeplerianOrbit(6878137, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, date, gm));
    // Create a mock builder that allows us to check the values passed to it
    PropagatorBuilder builder = Mockito.mock(PropagatorBuilder.class);
    ParameterDriversList list = new ParameterDriversList();
    list.add(new ParameterDriver("p1", 0, 1e-3, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
    Mockito.when(builder.getOrbitalParametersDrivers()).thenReturn(list);
    Mockito.when(builder.getPropagationParametersDrivers()).thenReturn(new ParameterDriversList());
    Mockito.when(builder.getFrame()).thenReturn(eci);
    Mockito.when(builder.getSelectedNormalizedParameters()).thenReturn(new double[1]);
    Mockito.when(builder.buildPropagator(Mockito.any(double[].class))).thenReturn(source);
    // subject under test
    FiniteDifferencePropagatorConverter converter = new FiniteDifferencePropagatorConverter(builder, 1, 100);
    // set some internal variables in FDPC that are not settable using another
    // interface
    converter.convert(source, 1, 2);
    // Forget all the side effect of the call to convert()
    Mockito.clearInvocations(builder);
    // action
    converter.getModel().value(new ArrayRealVector(1));
    // verify
    Mockito.verify(builder).buildPropagator(new double[] { 0 });
    Mockito.verify(builder).buildPropagator(new double[] { 1 });
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Frame(org.orekit.frames.Frame) ParameterDriversList(org.orekit.utils.ParameterDriversList) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) ArrayRealVector(org.hipparchus.linear.ArrayRealVector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ParameterDriver(org.orekit.utils.ParameterDriver) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 97 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class TLESeriesTest method testTLEFrame.

@Test
public void testTLEFrame() throws OrekitException {
    TLE tle = new TLE("1 27421U 02021A   02124.48976499 -.00021470  00000-0 -89879-2 0    20", "2 27421  98.7490 199.5121 0001333 133.9522 226.1918 14.26113993    62");
    Frame tleFrame = TLEPropagator.selectExtrapolator(tle).getFrame();
    Assert.assertEquals(tleFrame.getName(), FramesFactory.getFrame(Predefined.TEME).getName());
}
Also used : Frame(org.orekit.frames.Frame) Test(org.junit.Test)

Example 98 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue110.

@Test
public void testIssue110() throws OrekitException {
    // KEPLERIAN PROPAGATOR
    final Frame eme2000Frame = FramesFactory.getEME2000();
    final AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH;
    final double a = 7000000.0;
    final Orbit initialOrbit = new KeplerianOrbit(a, 0.0, FastMath.PI / 2.2, 0.0, FastMath.PI / 2., 0.0, PositionAngle.TRUE, eme2000Frame, initDate, Constants.EGM96_EARTH_MU);
    final KeplerianPropagator kProp = new KeplerianPropagator(initialOrbit);
    // earth shape
    final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    // Ground station
    final GeodeticPoint stat = new GeodeticPoint(FastMath.toRadians(35.), FastMath.toRadians(149.8), 0.);
    final TopocentricFrame station = new TopocentricFrame(earthShape, stat, "GSTATION");
    // detector creation
    // =================
    final double maxCheck = 600.;
    final double threshold = 1.0e-3;
    final EventDetector rawEvent = new ElevationDetector(maxCheck, threshold, station).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kProp.addEventDetector(logger.monitorDetector(rawEvent));
    // PROPAGATION with DETECTION
    final AbsoluteDate finalDate = initDate.shiftedBy(30 * 60.);
    kProp.propagate(finalDate);
    Assert.assertEquals(2, logger.getLoggedEvents().size());
    Assert.assertTrue(logger.getLoggedEvents().get(0).isIncreasing());
    Assert.assertEquals(478.945, logger.getLoggedEvents().get(0).getState().getDate().durationFrom(initDate), 1.0e-3);
    Assert.assertFalse(logger.getLoggedEvents().get(1).isIncreasing());
    Assert.assertEquals(665.721, logger.getLoggedEvents().get(1).getState().getDate().durationFrom(initDate), 1.0e-3);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TopocentricFrame(org.orekit.frames.TopocentricFrame) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 99 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue136.

@Test
public void testIssue136() throws OrekitException {
    // Initial state definition : date, orbit
    AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    // inertial frame for orbit definition
    Frame inertialFrame = FramesFactory.getEME2000();
    Orbit initialOrbit = new KeplerianOrbit(6828137.005, 7.322641382145889e-10, 1.6967079057368113, 0.0, 1.658054062748353, 0.0001223149429077902, PositionAngle.MEAN, inertialFrame, initialDate, Constants.EIGEN5C_EARTH_MU);
    // Propagator : consider a simple Keplerian motion (could be more elaborate)
    Propagator kepler = new EcksteinHechlerPropagator(initialOrbit, Constants.EGM96_EARTH_EQUATORIAL_RADIUS, Constants.EGM96_EARTH_MU, Constants.EGM96_EARTH_C20, 0.0, 0.0, 0.0, 0.0);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    // Station
    final double longitude = FastMath.toRadians(-147.5);
    final double latitude = FastMath.toRadians(64);
    final double altitude = 160;
    final GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
    final TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
    // Event definition
    final double maxcheck = 120.0;
    final double elevation = FastMath.toRadians(5.);
    final double threshold = 10.0;
    final EventDetector rawEvent = new ElevationDetector(maxcheck, threshold, sta1Frame).withConstantElevation(elevation).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kepler.addEventDetector(logger.monitorDetector(rawEvent));
    // Propagate from the initial date to the first raising or for the fixed duration
    kepler.propagate(initialDate.shiftedBy(60 * 60 * 24.0 * 40));
    int countIncreasing = 0;
    int countDecreasing = 0;
    for (LoggedEvent le : logger.getLoggedEvents()) {
        if (le.isIncreasing()) {
            ++countIncreasing;
        } else {
            ++countDecreasing;
        }
    }
    Assert.assertEquals(314, countIncreasing);
    Assert.assertEquals(314, countDecreasing);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 100 with Frame

use of org.orekit.frames.Frame in project Orekit by CS-SI.

the class ElevationDetectorTest method testEventForMask.

@Test
public void testEventForMask() throws OrekitException {
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(48.833), FastMath.toRadians(2.333), 0.0);
    TopocentricFrame topo = new TopocentricFrame(earth, point, "Gstation");
    double[][] maskValues = { { FastMath.toRadians(0), FastMath.toRadians(5) }, { FastMath.toRadians(30), FastMath.toRadians(4) }, { FastMath.toRadians(60), FastMath.toRadians(3) }, { FastMath.toRadians(90), FastMath.toRadians(2) }, { FastMath.toRadians(120), FastMath.toRadians(3) }, { FastMath.toRadians(150), FastMath.toRadians(4) }, { FastMath.toRadians(180), FastMath.toRadians(5) }, { FastMath.toRadians(210), FastMath.toRadians(6) }, { FastMath.toRadians(240), FastMath.toRadians(5) }, { FastMath.toRadians(270), FastMath.toRadians(4) }, { FastMath.toRadians(300), FastMath.toRadians(3) }, { FastMath.toRadians(330), FastMath.toRadians(4) } };
    ElevationMask mask = new ElevationMask(maskValues);
    ElevationDetector detector = new ElevationDetector(topo).withElevationMask(mask).withHandler(new StopOnIncreasing<ElevationDetector>());
    Assert.assertSame(mask, detector.getElevationMask());
    AbsoluteDate startDate = new AbsoluteDate(2003, 9, 15, 20, 0, 0, utc);
    propagator.resetInitialState(propagator.propagate(startDate));
    propagator.addEventDetector(detector);
    final SpacecraftState fs = propagator.propagate(startDate.shiftedBy(Constants.JULIAN_DAY));
    double elevation = topo.getElevation(fs.getPVCoordinates().getPosition(), fs.getFrame(), fs.getDate());
    Assert.assertEquals(0.065, elevation, 2.0e-5);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) ElevationMask(org.orekit.utils.ElevationMask) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

Frame (org.orekit.frames.Frame)257 Test (org.junit.Test)169 AbsoluteDate (org.orekit.time.AbsoluteDate)153 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)117 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)99 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)79 SpacecraftState (org.orekit.propagation.SpacecraftState)79 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)70 OrekitException (org.orekit.errors.OrekitException)60 PVCoordinates (org.orekit.utils.PVCoordinates)58 Orbit (org.orekit.orbits.Orbit)51 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)50 TimeScale (org.orekit.time.TimeScale)46 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)46 GeodeticPoint (org.orekit.bodies.GeodeticPoint)41 TopocentricFrame (org.orekit.frames.TopocentricFrame)38 Transform (org.orekit.frames.Transform)38 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)35 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)33 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)31