Search in sources :

Example 31 with TimeComponents

use of org.orekit.time.TimeComponents in project Orekit by CS-SI.

the class TLETest method testDirectConstruction.

@Test
public void testDirectConstruction() throws OrekitException {
    TLE tleA = new TLE(5555, 'U', 1971, 86, "J", 0, 908, new AbsoluteDate(new DateComponents(2012, 26), new TimeComponents(0.96078249 * Constants.JULIAN_DAY), TimeScalesFactory.getUTC()), taylorConvert(12.26882470, 1), taylorConvert(-0.00000004, 2), taylorConvert(0.00001e-9, 3), 0.0075476, FastMath.toRadians(74.0161), FastMath.toRadians(328.9888), FastMath.toRadians(228.9750), FastMath.toRadians(30.6709), 80454, 0.01234e-9);
    TLE tleB = new TLE("1 05555U 71086J   12026.96078249 -.00000004  00001-9  01234-9 0  9082", "2 05555  74.0161 228.9750 0075476 328.9888  30.6709 12.26882470804545");
    Assert.assertEquals(tleA.getSatelliteNumber(), tleB.getSatelliteNumber(), 0);
    Assert.assertEquals(tleA.getLaunchYear(), tleB.getLaunchYear());
    Assert.assertEquals(tleA.getLaunchNumber(), tleB.getLaunchNumber());
    Assert.assertEquals(tleA.getLaunchPiece(), tleB.getLaunchPiece());
    Assert.assertEquals(tleA.getBStar(), tleB.getBStar(), 0);
    Assert.assertEquals(tleA.getEphemerisType(), tleB.getEphemerisType());
    Assert.assertEquals(tleA.getI(), tleB.getI(), 1e-10);
    Assert.assertEquals(tleA.getRaan(), tleB.getRaan(), 1e-10);
    Assert.assertEquals(tleA.getE(), tleB.getE(), 1e-10);
    Assert.assertEquals(tleA.getPerigeeArgument(), tleB.getPerigeeArgument(), 1e-10);
    Assert.assertEquals(tleA.getMeanAnomaly(), tleB.getMeanAnomaly(), 1e-10);
    Assert.assertEquals(tleA.getMeanMotion(), tleB.getMeanMotion(), 0);
    Assert.assertEquals(tleA.getRevolutionNumberAtEpoch(), tleB.getRevolutionNumberAtEpoch(), 0);
    Assert.assertEquals(tleA.getElementNumber(), tleB.getElementNumber(), 0);
}
Also used : DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 32 with TimeComponents

use of org.orekit.time.TimeComponents in project Orekit by CS-SI.

the class LofOffsetPointingTest method testTypesField.

@Test
public void testTypesField() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    for (final LOFType type : LOFType.values()) {
        RotationOrder order = RotationOrder.ZXY;
        double alpha1 = 0.123;
        double alpha2 = 0.456;
        double alpha3 = 0.789;
        LofOffset law = new LofOffset(orbit.getFrame(), type, order, alpha1, alpha2, alpha3);
        final Vector3D dir;
        switch(type) {
            case TNW:
                dir = Vector3D.PLUS_J;
                break;
            case QSW:
            case LVLH:
                dir = Vector3D.MINUS_I;
                break;
            case VVLH:
                dir = Vector3D.PLUS_K;
                break;
            default:
                // VNC
                dir = Vector3D.MINUS_K;
        }
        LofOffsetPointing lop = new LofOffsetPointing(orbit.getFrame(), earthSpheric, law, dir);
        checkField(Decimal64Field.getInstance(), lop, orbit, date, orbit.getFrame());
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) LOFType(org.orekit.frames.LOFType) RotationOrder(org.hipparchus.geometry.euclidean.threed.RotationOrder) 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 33 with TimeComponents

use of org.orekit.time.TimeComponents in project Orekit by CS-SI.

the class InertialAttitudeTest method testSpin.

@Test
public void testSpin() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2, RotationConvention.VECTOR_OPERATOR));
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    Propagator propagator = new KeplerianPropagator(orbit, law);
    double h = 100.0;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
    // check spin is consistent with attitude evolution
    double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 1.0e-6 * evolutionAngleMinus);
    double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 1.0e-6 * evolutionAnglePlus);
    // compute spin axis using finite differences
    Rotation rMinus = sMinus.getAttitude().getRotation();
    Rotation rPlus = sPlus.getAttitude().getRotation();
    Rotation dr = rPlus.compose(rMinus.revert(), RotationConvention.VECTOR_OPERATOR);
    Assert.assertEquals(0, dr.getAngle(), 1.0e-10);
    Vector3D spin0 = s0.getAttitude().getSpin();
    Assert.assertEquals(0, spin0.getNorm(), 1.0e-10);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 34 with TimeComponents

use of org.orekit.time.TimeComponents in project Orekit by CS-SI.

the class LofOffsetTest method testRetrieveAngles.

@Test
public void testRetrieveAngles() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    RotationOrder order = RotationOrder.ZXY;
    double alpha1 = 0.123;
    double alpha2 = 0.456;
    double alpha3 = 0.789;
    LofOffset law = new LofOffset(orbit.getFrame(), LOFType.VVLH, order, alpha1, alpha2, alpha3);
    Rotation offsetAtt = law.getAttitude(orbit, date, orbit.getFrame()).getRotation();
    Rotation alignedAtt = new LofOffset(orbit.getFrame(), LOFType.VVLH).getAttitude(orbit, date, orbit.getFrame()).getRotation();
    Rotation offsetProper = offsetAtt.compose(alignedAtt.revert(), RotationConvention.VECTOR_OPERATOR);
    double[] anglesV = offsetProper.revert().getAngles(order, RotationConvention.VECTOR_OPERATOR);
    Assert.assertEquals(alpha1, anglesV[0], 1.0e-11);
    Assert.assertEquals(alpha2, anglesV[1], 1.0e-11);
    Assert.assertEquals(alpha3, anglesV[2], 1.0e-11);
    double[] anglesF = offsetProper.getAngles(order, RotationConvention.FRAME_TRANSFORM);
    Assert.assertEquals(alpha1, anglesF[0], 1.0e-11);
    Assert.assertEquals(alpha2, anglesF[1], 1.0e-11);
    Assert.assertEquals(alpha3, anglesF[2], 1.0e-11);
}
Also used : RotationOrder(org.hipparchus.geometry.euclidean.threed.RotationOrder) DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 35 with TimeComponents

use of org.orekit.time.TimeComponents in project Orekit by CS-SI.

the class LofOffsetTest method testTypesField.

@Test
public void testTypesField() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    for (final LOFType type : LOFType.values()) {
        RotationOrder order = RotationOrder.ZXY;
        double alpha1 = 0.123;
        double alpha2 = 0.456;
        double alpha3 = 0.789;
        LofOffset law = new LofOffset(orbit.getFrame(), type, order, alpha1, alpha2, alpha3);
        checkField(Decimal64Field.getInstance(), law, orbit, date, orbit.getFrame());
    }
}
Also used : LOFType(org.orekit.frames.LOFType) RotationOrder(org.hipparchus.geometry.euclidean.threed.RotationOrder) 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)

Aggregations

TimeComponents (org.orekit.time.TimeComponents)88 DateComponents (org.orekit.time.DateComponents)87 AbsoluteDate (org.orekit.time.AbsoluteDate)84 Test (org.junit.Test)72 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)55 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)55 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)47 Orbit (org.orekit.orbits.Orbit)44 SpacecraftState (org.orekit.propagation.SpacecraftState)42 CartesianOrbit (org.orekit.orbits.CartesianOrbit)35 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)35 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)32 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)28 PVCoordinates (org.orekit.utils.PVCoordinates)24 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)22 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)17 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)17 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)17 CircularOrbit (org.orekit.orbits.CircularOrbit)16 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)16