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);
}
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);
}
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());
}
}
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());
}
}
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);
}
Aggregations