Search in sources :

Example 11 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class AlignmentDetectorTest method testAlignment.

@Test
public void testAlignment() throws OrekitException {
    double alignAngle = FastMath.toRadians(0.0);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    AlignmentDetector alignDetector = new AlignmentDetector(initialState.getOrbit(), sun, alignAngle).withMaxCheck(60.0);
    Assert.assertEquals(alignAngle, alignDetector.getAlignAngle(), 1.0e-15);
    Assert.assertSame(sun, alignDetector.getPVCoordinatesProvider());
    Assert.assertEquals(60.0, alignDetector.getMaxCheckInterval(), 1.0e-15);
    propagator.addEventDetector(alignDetector);
    final SpacecraftState finalState = propagator.propagate(iniDate.shiftedBy(6000));
    Assert.assertEquals(383.3662, finalState.getDate().durationFrom(iniDate), 1.0e-3);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) Test(org.junit.Test)

Example 12 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class CircularFieldOfViewDetectorTest method testCircularFielOfView.

@Test
public void testCircularFielOfView() throws OrekitException {
    // Definition of initial conditions with position and velocity
    // ------------------------------------------------------------
    // Extrapolator definition
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, earthCenterAttitudeLaw);
    // Event definition : circular field of view, along X axis, aperture 35°
    final double maxCheck = 1.;
    final PVCoordinatesProvider sunPV = CelestialBodyFactory.getSun();
    final Vector3D center = Vector3D.PLUS_I;
    final double aperture = FastMath.toRadians(35);
    final CircularFieldOfViewDetector sunVisi = new CircularFieldOfViewDetector(maxCheck, sunPV, center, aperture).withHandler(new CircularSunVisiHandler());
    Assert.assertEquals(0, Vector3D.distance(center, sunVisi.getCenter()), 1.0e-15);
    Assert.assertEquals(aperture, sunVisi.getHalfAperture(), 1.0e-15);
    Assert.assertSame(sunPV, sunVisi.getPVTarget());
    // Add event to be detected
    propagator.addEventDetector(sunVisi);
    // Extrapolate from the initial to the final date
    propagator.propagate(initDate.shiftedBy(6000.));
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) Test(org.junit.Test)

Example 13 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class AngularSeparationDetectorTest method testCentralSunTransit.

@Test
public void testCentralSunTransit() throws OrekitException {
    double proximityAngle = FastMath.toRadians(0.1);
    double maxCheck = 0.1 * proximityAngle / initialOrbit.getKeplerianMeanMotion();
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    AngularSeparationDetector detector = new AngularSeparationDetector(sun, acatenango, proximityAngle).withMaxCheck(maxCheck).withThreshold(1.0e-6);
    Assert.assertEquals(proximityAngle, detector.getProximityAngle(), 1.0e-15);
    Assert.assertSame(sun, detector.getBeacon());
    Assert.assertSame(acatenango, detector.getObserver());
    Assert.assertEquals(maxCheck, detector.getMaxCheckInterval(), 1.0e-15);
    propagator.addEventDetector(detector);
    final SpacecraftState finalState = propagator.propagate(iniDate.shiftedBy(7000.0));
    Assert.assertEquals(1921.1311, finalState.getDate().durationFrom(iniDate), 1.0e-3);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) Test(org.junit.Test)

Example 14 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class SpinStabilizedTest method testBBQMode.

@Test
public void testBBQMode() throws OrekitException {
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getTAI());
    double rate = 2.0 * FastMath.PI / (12 * 60);
    AttitudeProvider cbp = new CelestialBodyPointed(FramesFactory.getEME2000(), sun, Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_K);
    SpinStabilized bbq = new SpinStabilized(cbp, date, Vector3D.PLUS_K, rate);
    PVCoordinates pv = new PVCoordinates(new Vector3D(28812595.32012577, 5948437.4640250085, 0), new Vector3D(0, 0, 3680.853673522056));
    KeplerianOrbit kep = new KeplerianOrbit(pv, FramesFactory.getEME2000(), date, 3.986004415e14);
    Attitude attitude = bbq.getAttitude(kep, date, kep.getFrame());
    checkField(Decimal64Field.getInstance(), bbq, kep, kep.getDate(), kep.getFrame());
    Vector3D xDirection = attitude.getRotation().applyInverseTo(Vector3D.PLUS_I);
    Assert.assertEquals(FastMath.atan(1.0 / 5000.0), Vector3D.angle(xDirection, sun.getPVCoordinates(date, FramesFactory.getEME2000()).getPosition()), 2.0e-15);
    Assert.assertEquals(rate, attitude.getSpin().getNorm(), 1.0e-6);
    Assert.assertSame(cbp, bbq.getUnderlyingAttitudeProvider());
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) PVCoordinates(org.orekit.utils.PVCoordinates) DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 15 with PVCoordinatesProvider

use of org.orekit.utils.PVCoordinatesProvider in project Orekit by CS-SI.

the class OneAxisEllipsoidTest method testGroundProjectionTaylor.

@Test
public void testGroundProjectionTaylor() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
    TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.), new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);
    TimeStampedPVCoordinates pv0 = orbit.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    PVCoordinatesProvider groundTaylor = model.projectToGround(pv0, model.getBodyFrame()).toTaylorProvider(model.getBodyFrame());
    TimeStampedPVCoordinates g0 = groundTaylor.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    Vector3D zenith = pv0.getPosition().subtract(g0.getPosition()).normalize();
    Vector3D acrossTrack = Vector3D.crossProduct(zenith, g0.getVelocity()).normalize();
    Vector3D alongTrack = Vector3D.crossProduct(acrossTrack, zenith).normalize();
    for (double dt = -1; dt < 1; dt += 0.01) {
        AbsoluteDate date = orbit.getDate().shiftedBy(dt);
        Vector3D taylorP = groundTaylor.getPVCoordinates(date, model.getBodyFrame()).getPosition();
        Vector3D refP = model.projectToGround(orbit.getPVCoordinates(date, model.getBodyFrame()).getPosition(), date, model.getBodyFrame());
        Vector3D delta = taylorP.subtract(refP);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, alongTrack), 0.0015);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, acrossTrack), 0.0007);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, zenith), 0.00002);
    }
}
Also used : Frame(org.orekit.frames.Frame) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

PVCoordinatesProvider (org.orekit.utils.PVCoordinatesProvider)35 Test (org.junit.Test)28 Frame (org.orekit.frames.Frame)22 AbsoluteDate (org.orekit.time.AbsoluteDate)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)16 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)14 OrekitException (org.orekit.errors.OrekitException)13 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)12 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)11 SpacecraftState (org.orekit.propagation.SpacecraftState)11 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)8 Orbit (org.orekit.orbits.Orbit)8 DateComponents (org.orekit.time.DateComponents)8 TimeComponents (org.orekit.time.TimeComponents)8 AttitudeProvider (org.orekit.attitudes.AttitudeProvider)7 DummyLocalizable (org.hipparchus.exception.DummyLocalizable)6 GeodeticPoint (org.orekit.bodies.GeodeticPoint)6 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)6 TopocentricFrame (org.orekit.frames.TopocentricFrame)6