use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.
the class HarmonicParametricAccelerationTest method testEquivalentTangentialOverriddenManeuver.
@Test
public void testEquivalentTangentialOverriddenManeuver() throws OrekitException {
final double mass = 2500;
final double isp = Double.POSITIVE_INFINITY;
final double duration = 4000;
final double f = 400;
final AttitudeProvider maneuverLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VNC);
ConstantThrustManeuver maneuver = new ConstantThrustManeuver(initialOrbit.getDate().shiftedBy(-10.0), duration, f, isp, Vector3D.PLUS_I);
final AttitudeProvider accelerationLaw = new CelestialBodyPointed(initialOrbit.getFrame(), CelestialBodyFactory.getSun(), Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_K);
final HarmonicParametricAcceleration lofAcceleration = new HarmonicParametricAcceleration(Vector3D.PLUS_I, maneuverLaw, "prefix", null, Double.POSITIVE_INFINITY, 1);
lofAcceleration.getParametersDrivers()[0].setValue(f / mass);
lofAcceleration.getParametersDrivers()[1].setValue(0.5 * FastMath.PI);
doTestEquivalentManeuver(mass, maneuverLaw, maneuver, accelerationLaw, lofAcceleration, 1.0e-15);
}
use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.
the class HarmonicParametricAccelerationTest method testEquivalentInertialManeuver.
@Test
public void testEquivalentInertialManeuver() throws OrekitException {
final double delta = FastMath.toRadians(-7.4978);
final double alpha = FastMath.toRadians(351);
final Vector3D direction = new Vector3D(alpha, delta);
final double mass = 2500;
final double isp = Double.POSITIVE_INFINITY;
final double duration = 4000;
final double f = 400;
final AttitudeProvider maneuverLaw = new InertialProvider(new Rotation(direction, Vector3D.PLUS_I));
ConstantThrustManeuver maneuver = new ConstantThrustManeuver(initialOrbit.getDate().shiftedBy(-10.0), duration, f, isp, Vector3D.PLUS_I);
final AttitudeProvider accelerationLaw = new InertialProvider(new Rotation(direction, Vector3D.PLUS_K));
final HarmonicParametricAcceleration inertialAcceleration = new HarmonicParametricAcceleration(direction, true, "", AbsoluteDate.J2000_EPOCH, Double.POSITIVE_INFINITY, 1);
Assert.assertTrue(inertialAcceleration.dependsOnPositionOnly());
inertialAcceleration.getParametersDrivers()[0].setValue(f / mass);
inertialAcceleration.getParametersDrivers()[1].setValue(0.5 * FastMath.PI);
doTestEquivalentManeuver(mass, maneuverLaw, maneuver, accelerationLaw, inertialAcceleration, 1.0e-15);
}
use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.
the class HarmonicParametricAccelerationTest method testEquivalentInertialManeuverField.
@Test
public void testEquivalentInertialManeuverField() throws OrekitException {
final double delta = FastMath.toRadians(-7.4978);
final double alpha = FastMath.toRadians(351);
final Vector3D direction = new Vector3D(alpha, delta);
final double mass = 2500;
final double isp = Double.POSITIVE_INFINITY;
final double duration = 4000;
final double f = 400;
final AttitudeProvider maneuverLaw = new InertialProvider(new Rotation(direction, Vector3D.PLUS_I));
ConstantThrustManeuver maneuver = new ConstantThrustManeuver(initialOrbit.getDate().shiftedBy(-10.0), duration, f, isp, Vector3D.PLUS_I);
final AttitudeProvider accelerationLaw = new InertialProvider(new Rotation(direction, Vector3D.PLUS_K));
final HarmonicParametricAcceleration inertialAcceleration = new HarmonicParametricAcceleration(direction, true, "", AbsoluteDate.J2000_EPOCH, Double.POSITIVE_INFINITY, 1);
inertialAcceleration.getParametersDrivers()[0].setValue(f / mass);
inertialAcceleration.getParametersDrivers()[1].setValue(0.5 * FastMath.PI);
doTestEquivalentManeuver(Decimal64Field.getInstance(), mass, maneuverLaw, maneuver, accelerationLaw, inertialAcceleration, 3.0e-9);
}
use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.
the class HarmonicParametricAccelerationTest method testEquivalentTangentialManeuverField.
@Test
public void testEquivalentTangentialManeuverField() throws OrekitException {
final double mass = 2500;
final double isp = Double.POSITIVE_INFINITY;
final double duration = 4000;
final double f = 400;
final AttitudeProvider commonLaw = new LofOffset(initialOrbit.getFrame(), LOFType.VNC);
ConstantThrustManeuver maneuver = new ConstantThrustManeuver(initialOrbit.getDate().shiftedBy(-10.0), duration, f, isp, Vector3D.PLUS_I);
final HarmonicParametricAcceleration lofAcceleration = new HarmonicParametricAcceleration(Vector3D.PLUS_I, false, "", null, Double.POSITIVE_INFINITY, 1);
lofAcceleration.getParametersDrivers()[0].setValue(f / mass);
lofAcceleration.getParametersDrivers()[1].setValue(0.5 * FastMath.PI);
doTestEquivalentManeuver(Decimal64Field.getInstance(), mass, commonLaw, maneuver, commonLaw, lofAcceleration, 1.0e-15);
}
use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.
the class HarmonicParametricAccelerationTest method testCoefficientsDetermination.
@Test
public void testCoefficientsDetermination() throws OrekitException {
final double mass = 2500;
final Orbit orbit = new CircularOrbit(7500000.0, 1.0e-4, 1.0e-3, 1.7, 0.3, 0.5, PositionAngle.TRUE, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2004, 2, 3), TimeComponents.H00, TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
final double period = orbit.getKeplerianPeriod();
AttitudeProvider maneuverLaw = new LofOffset(orbit.getFrame(), LOFType.VNC);
SpacecraftState initialState = new SpacecraftState(orbit, maneuverLaw.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
double dP = 10.0;
double minStep = 0.001;
double maxStep = 100;
double[][] tolerance = NumericalPropagator.tolerances(dP, orbit, orbit.getType());
// generate PV measurements corresponding to a tangential maneuver
AdaptiveStepsizeIntegrator integrator0 = new DormandPrince853Integrator(minStep, maxStep, tolerance[0], tolerance[1]);
integrator0.setInitialStepSize(60);
final NumericalPropagator propagator0 = new NumericalPropagator(integrator0);
propagator0.setInitialState(initialState);
propagator0.setAttitudeProvider(maneuverLaw);
ForceModel hpaRefX1 = new HarmonicParametricAcceleration(Vector3D.PLUS_I, true, "refX1", null, period, 1);
ForceModel hpaRefY1 = new HarmonicParametricAcceleration(Vector3D.PLUS_J, true, "refY1", null, period, 1);
ForceModel hpaRefZ2 = new HarmonicParametricAcceleration(Vector3D.PLUS_K, true, "refZ2", null, period, 2);
hpaRefX1.getParametersDrivers()[0].setValue(2.4e-2);
hpaRefX1.getParametersDrivers()[1].setValue(3.1);
hpaRefY1.getParametersDrivers()[0].setValue(4.0e-2);
hpaRefY1.getParametersDrivers()[1].setValue(0.3);
hpaRefZ2.getParametersDrivers()[0].setValue(1.0e-2);
hpaRefZ2.getParametersDrivers()[1].setValue(1.8);
propagator0.addForceModel(hpaRefX1);
propagator0.addForceModel(hpaRefY1);
propagator0.addForceModel(hpaRefZ2);
final List<ObservedMeasurement<?>> measurements = new ArrayList<>();
propagator0.setMasterMode(10.0, (state, isLast) -> measurements.add(new PV(state.getDate(), state.getPVCoordinates().getPosition(), state.getPVCoordinates().getVelocity(), 1.0e-3, 1.0e-6, 1.0)));
propagator0.propagate(orbit.getDate().shiftedBy(900));
// set up an estimator to retrieve the maneuver as several harmonic accelerations in inertial frame
final NumericalPropagatorBuilder propagatorBuilder = new NumericalPropagatorBuilder(orbit, new DormandPrince853IntegratorBuilder(minStep, maxStep, dP), PositionAngle.TRUE, dP);
propagatorBuilder.addForceModel(new HarmonicParametricAcceleration(Vector3D.PLUS_I, true, "X1", null, period, 1));
propagatorBuilder.addForceModel(new HarmonicParametricAcceleration(Vector3D.PLUS_J, true, "Y1", null, period, 1));
propagatorBuilder.addForceModel(new HarmonicParametricAcceleration(Vector3D.PLUS_K, true, "Z2", null, period, 2));
final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder);
estimator.setParametersConvergenceThreshold(1.0e-2);
estimator.setMaxIterations(20);
estimator.setMaxEvaluations(100);
for (final ObservedMeasurement<?> measurement : measurements) {
estimator.addMeasurement(measurement);
}
// we will estimate only the force model parameters, not the orbit
for (final ParameterDriver d : estimator.getOrbitalParametersDrivers(false).getDrivers()) {
d.setSelected(false);
}
setParameter(estimator, "X1 γ", 1.0e-2);
setParameter(estimator, "X1 φ", 4.0);
setParameter(estimator, "Y1 γ", 1.0e-2);
setParameter(estimator, "Y1 φ", 0.0);
setParameter(estimator, "Z2 γ", 1.0e-2);
setParameter(estimator, "Z2 φ", 1.0);
estimator.estimate();
Assert.assertTrue(estimator.getIterationsCount() < 15);
Assert.assertTrue(estimator.getEvaluationsCount() < 15);
Assert.assertEquals(0.0, estimator.getOptimum().getRMS(), 1.0e-5);
Assert.assertEquals(hpaRefX1.getParametersDrivers()[0].getValue(), getParameter(estimator, "X1 γ"), 1.e-12);
Assert.assertEquals(hpaRefX1.getParametersDrivers()[1].getValue(), getParameter(estimator, "X1 φ"), 1.e-12);
Assert.assertEquals(hpaRefY1.getParametersDrivers()[0].getValue(), getParameter(estimator, "Y1 γ"), 1.e-12);
Assert.assertEquals(hpaRefY1.getParametersDrivers()[1].getValue(), getParameter(estimator, "Y1 φ"), 1.e-12);
Assert.assertEquals(hpaRefZ2.getParametersDrivers()[0].getValue(), getParameter(estimator, "Z2 γ"), 1.e-12);
Assert.assertEquals(hpaRefZ2.getParametersDrivers()[1].getValue(), getParameter(estimator, "Z2 φ"), 1.e-12);
}
Aggregations