Search in sources :

Example 26 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class ImpulseManeuverTest method testInertialManeuver.

@Test
public void testInertialManeuver() throws OrekitException {
    final double mu = CelestialBodyFactory.getEarth().getGM();
    final double initialX = 7100e3;
    final double initialY = 0.0;
    final double initialZ = 1300e3;
    final double initialVx = 0;
    final double initialVy = 8000;
    final double initialVz = 1000;
    final Vector3D position = new Vector3D(initialX, initialY, initialZ);
    final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz);
    final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC());
    final TimeStampedPVCoordinates state = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);
    final Orbit initialOrbit = new CartesianOrbit(state, FramesFactory.getEME2000(), mu);
    final double totalPropagationTime = 0.00001;
    final double driftTimeInSec = totalPropagationTime / 2.0;
    final double deltaX = 0.01;
    final double deltaY = 0.02;
    final double deltaZ = 0.03;
    final double isp = 300;
    final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ);
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC));
    DateDetector dateDetector = new DateDetector(epoch.shiftedBy(driftTimeInSec));
    InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, RotationConvention.VECTOR_OPERATOR, 0, 0, 0));
    ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(driftTimeInSec / 4);
    propagator.addEventDetector(burnAtEpoch);
    SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime));
    final double finalVxExpected = initialVx + deltaX;
    final double finalVyExpected = initialVy + deltaY;
    final double finalVzExpected = initialVz + deltaZ;
    final double maneuverTolerance = 1e-4;
    final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity();
    Assert.assertEquals(finalVxExpected, finalVelocity.getX(), maneuverTolerance);
    Assert.assertEquals(finalVyExpected, finalVelocity.getY(), maneuverTolerance);
    Assert.assertEquals(finalVzExpected, finalVelocity.getZ(), maneuverTolerance);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) LofOffset(org.orekit.attitudes.LofOffset) Test(org.junit.Test)

Example 27 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class ImpulseManeuverTest method testAdditionalStateKeplerian.

@Test
public void testAdditionalStateKeplerian() throws OrekitException {
    final double mu = CelestialBodyFactory.getEarth().getGM();
    final double initialX = 7100e3;
    final double initialY = 0.0;
    final double initialZ = 1300e3;
    final double initialVx = 0;
    final double initialVy = 8000;
    final double initialVz = 1000;
    final Vector3D position = new Vector3D(initialX, initialY, initialZ);
    final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz);
    final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC());
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);
    final Orbit initialOrbit = new CartesianOrbit(pv, FramesFactory.getEME2000(), mu);
    final double totalPropagationTime = 10;
    final double deltaX = 0.01;
    final double deltaY = 0.02;
    final double deltaZ = 0.03;
    final double isp = 300;
    final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ);
    final AttitudeProvider attitudeProvider = new LofOffset(initialOrbit.getFrame(), LOFType.VNC);
    final Attitude initialAttitude = attitudeProvider.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame());
    final SpacecraftState initialState = new SpacecraftState(initialOrbit, initialAttitude);
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit);
    propagator.resetInitialState(initialState.addAdditionalState("testOnly", -1.0));
    DateDetector dateDetector = new DateDetector(epoch.shiftedBy(0.5 * totalPropagationTime));
    InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, RotationConvention.VECTOR_OPERATOR, 0, 0, 0));
    ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(1.0e-3);
    propagator.addEventDetector(burnAtEpoch);
    SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime));
    Assert.assertEquals(1, finalState.getAdditionalStates().size());
    Assert.assertEquals(-1.0, finalState.getAdditionalState("testOnly")[0], 1.0e-15);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Attitude(org.orekit.attitudes.Attitude) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Example 28 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testParameterDerivativeIsotropicCnes.

@Test
public void testParameterDerivativeIsotropicCnes() throws OrekitException {
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), Constants.EIGEN5C_EARTH_MU));
    RadiationSensitive rs = new IsotropicRadiationCNES95Convention(2.5, 0.7, 0.2);
    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, rs);
    checkParameterDerivative(state, forceModel, RadiationSensitive.ABSORPTION_COEFFICIENT, 0.25, 2.5e-15);
    checkParameterDerivative(state, forceModel, RadiationSensitive.REFLECTION_COEFFICIENT, 0.25, 2.0e-14);
    try {
        rs.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), Vector3D.ZERO, new double[2], "UNKNOWN");
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 29 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testParameterDerivativeIsotropicClassical.

@Test
public void testParameterDerivativeIsotropicClassical() throws OrekitException {
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), Constants.EIGEN5C_EARTH_MU));
    RadiationSensitive rs = new IsotropicRadiationClassicalConvention(2.5, 0.7, 0.2);
    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, rs);
    checkParameterDerivative(state, forceModel, RadiationSensitive.ABSORPTION_COEFFICIENT, 0.25, 6.7e-16);
    checkParameterDerivative(state, forceModel, RadiationSensitive.REFLECTION_COEFFICIENT, 0.25, 5.1e-16);
    try {
        rs.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), Vector3D.ZERO, new double[2], "UNKNOWN");
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 30 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testParameterDerivativeBox.

@Test
public void testParameterDerivativeBox() throws OrekitException {
    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06, -1.32931592294715829e+04);
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03, -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel), FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()), Constants.EIGEN5C_EARTH_MU));
    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
    checkParameterDerivative(state, forceModel, RadiationSensitive.ABSORPTION_COEFFICIENT, 0.25, 1.9e-15);
    checkParameterDerivative(state, forceModel, RadiationSensitive.REFLECTION_COEFFICIENT, 0.25, 6.9e-15);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) BoxAndSolarArraySpacecraft(org.orekit.forces.BoxAndSolarArraySpacecraft) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Aggregations

CartesianOrbit (org.orekit.orbits.CartesianOrbit)57 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)48 AbsoluteDate (org.orekit.time.AbsoluteDate)43 SpacecraftState (org.orekit.propagation.SpacecraftState)38 Test (org.junit.Test)37 PVCoordinates (org.orekit.utils.PVCoordinates)32 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)28 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)25 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)22 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)20 Orbit (org.orekit.orbits.Orbit)20 Frame (org.orekit.frames.Frame)17 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)15 OrekitException (org.orekit.errors.OrekitException)14 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)14 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)13 BoundedPropagator (org.orekit.propagation.BoundedPropagator)11 Propagator (org.orekit.propagation.Propagator)10 TimeScale (org.orekit.time.TimeScale)10 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9