Search in sources :

Example 21 with AttitudeProvider

use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.

the class HarmonicParametricAccelerationTest method testEquivalentTangentialOverriddenManeuverField.

@Test
public void testEquivalentTangentialOverriddenManeuverField() 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(Decimal64Field.getInstance(), mass, maneuverLaw, maneuver, accelerationLaw, lofAcceleration, 1.0e-15);
}
Also used : CelestialBodyPointed(org.orekit.attitudes.CelestialBodyPointed) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Example 22 with AttitudeProvider

use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.

the class HarmonicParametricAccelerationTest method doTestEquivalentManeuver.

private void doTestEquivalentManeuver(final double mass, final AttitudeProvider maneuverLaw, final ConstantThrustManeuver maneuver, final AttitudeProvider accelerationLaw, final HarmonicParametricAcceleration parametricAcceleration, final double positionTolerance) throws OrekitException {
    SpacecraftState initialState = new SpacecraftState(initialOrbit, maneuverLaw.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame()), mass);
    double[][] tolerance = NumericalPropagator.tolerances(10, initialOrbit, initialOrbit.getType());
    // propagator 0 uses a maneuver that is so efficient it does not consume any fuel
    // (hence mass remains constant)
    AdaptiveStepsizeIntegrator integrator0 = new DormandPrince853Integrator(0.001, 100, tolerance[0], tolerance[1]);
    integrator0.setInitialStepSize(60);
    final NumericalPropagator propagator0 = new NumericalPropagator(integrator0);
    propagator0.setInitialState(initialState);
    propagator0.setAttitudeProvider(maneuverLaw);
    propagator0.addForceModel(maneuver);
    // propagator 1 uses a constant acceleration
    AdaptiveStepsizeIntegrator integrator1 = new DormandPrince853Integrator(0.001, 100, tolerance[0], tolerance[1]);
    integrator1.setInitialStepSize(60);
    final NumericalPropagator propagator1 = new NumericalPropagator(integrator1);
    propagator1.setInitialState(initialState);
    propagator1.setAttitudeProvider(accelerationLaw);
    propagator1.addForceModel(parametricAcceleration);
    MultiSatStepHandler handler = (interpolators, isLast) -> {
        Vector3D p0 = interpolators.get(0).getCurrentState().getPVCoordinates().getPosition();
        Vector3D p1 = interpolators.get(1).getCurrentState().getPVCoordinates().getPosition();
        Assert.assertEquals(0.0, Vector3D.distance(p0, p1), positionTolerance);
    };
    PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(Arrays.asList(propagator0, propagator1), handler);
    parallelizer.propagate(initialOrbit.getDate(), initialOrbit.getDate().shiftedBy(1000.0));
}
Also used : ParameterDriver(org.orekit.utils.ParameterDriver) Arrays(java.util.Arrays) AdaptiveStepsizeFieldIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeFieldIntegrator) LOFType(org.orekit.frames.LOFType) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) PVCoordinates(org.orekit.utils.PVCoordinates) SpacecraftState(org.orekit.propagation.SpacecraftState) LevenbergMarquardtOptimizer(org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer) PositionAngle(org.orekit.orbits.PositionAngle) Utils(org.orekit.Utils) CartesianOrbit(org.orekit.orbits.CartesianOrbit) PropagatorsParallelizer(org.orekit.propagation.PropagatorsParallelizer) FramesFactory(org.orekit.frames.FramesFactory) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) LofOffset(org.orekit.attitudes.LofOffset) List(java.util.List) InertialProvider(org.orekit.attitudes.InertialProvider) RealFieldElement(org.hipparchus.RealFieldElement) CelestialBodyPointed(org.orekit.attitudes.CelestialBodyPointed) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) PV(org.orekit.estimation.measurements.PV) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) MultiSatStepHandler(org.orekit.propagation.sampling.MultiSatStepHandler) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) Orbit(org.orekit.orbits.Orbit) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) ArrayList(java.util.ArrayList) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) DormandPrince853IntegratorBuilder(org.orekit.propagation.conversion.DormandPrince853IntegratorBuilder) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) FastMath(org.hipparchus.util.FastMath) FieldBoundedPropagator(org.orekit.propagation.FieldBoundedPropagator) Before(org.junit.Before) CircularOrbit(org.orekit.orbits.CircularOrbit) Constants(org.orekit.utils.Constants) DateComponents(org.orekit.time.DateComponents) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Test(org.junit.Test) Field(org.hipparchus.Field) OrekitException(org.orekit.errors.OrekitException) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) TimeScalesFactory(org.orekit.time.TimeScalesFactory) Decimal64Field(org.hipparchus.util.Decimal64Field) TimeComponents(org.orekit.time.TimeComponents) Assert(org.junit.Assert) BatchLSEstimator(org.orekit.estimation.leastsquares.BatchLSEstimator) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PropagatorsParallelizer(org.orekit.propagation.PropagatorsParallelizer) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) MultiSatStepHandler(org.orekit.propagation.sampling.MultiSatStepHandler)

Example 23 with AttitudeProvider

use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.

the class HarmonicParametricAccelerationTest method testEquivalentTangentialManeuver.

@Test
public void testEquivalentTangentialManeuver() 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);
    Assert.assertFalse(lofAcceleration.dependsOnPositionOnly());
    lofAcceleration.getParametersDrivers()[0].setValue(f / mass);
    lofAcceleration.getParametersDrivers()[1].setValue(0.5 * FastMath.PI);
    doTestEquivalentManeuver(mass, commonLaw, maneuver, commonLaw, lofAcceleration, 1.0e-15);
}
Also used : LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Example 24 with AttitudeProvider

use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.

the class PolynomialParametricAccelerationTest method doTestEquivalentManeuver.

private void doTestEquivalentManeuver(final double mass, final AttitudeProvider maneuverLaw, final ConstantThrustManeuver maneuver, final AttitudeProvider accelerationLaw, final PolynomialParametricAcceleration parametricAcceleration, final double positionTolerance) throws OrekitException {
    SpacecraftState initialState = new SpacecraftState(initialOrbit, maneuverLaw.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame()), mass);
    double[][] tolerance = NumericalPropagator.tolerances(10, initialOrbit, initialOrbit.getType());
    // propagator 0 uses a maneuver that is so efficient it does not consume any fuel
    // (hence mass remains constant)
    AdaptiveStepsizeIntegrator integrator0 = new DormandPrince853Integrator(0.001, 100, tolerance[0], tolerance[1]);
    integrator0.setInitialStepSize(60);
    final NumericalPropagator propagator0 = new NumericalPropagator(integrator0);
    propagator0.setInitialState(initialState);
    propagator0.setAttitudeProvider(maneuverLaw);
    propagator0.addForceModel(maneuver);
    // propagator 1 uses a constant acceleration
    AdaptiveStepsizeIntegrator integrator1 = new DormandPrince853Integrator(0.001, 100, tolerance[0], tolerance[1]);
    integrator1.setInitialStepSize(60);
    final NumericalPropagator propagator1 = new NumericalPropagator(integrator1);
    propagator1.setInitialState(initialState);
    propagator1.setAttitudeProvider(accelerationLaw);
    propagator1.addForceModel(parametricAcceleration);
    MultiSatStepHandler handler = (interpolators, isLast) -> {
        Vector3D p0 = interpolators.get(0).getCurrentState().getPVCoordinates().getPosition();
        Vector3D p1 = interpolators.get(1).getCurrentState().getPVCoordinates().getPosition();
        Assert.assertEquals(0.0, Vector3D.distance(p0, p1), positionTolerance);
    };
    PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(Arrays.asList(propagator0, propagator1), handler);
    parallelizer.propagate(initialOrbit.getDate(), initialOrbit.getDate().shiftedBy(1000.0));
}
Also used : DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) Arrays(java.util.Arrays) AdaptiveStepsizeFieldIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeFieldIntegrator) LOFType(org.orekit.frames.LOFType) MultiSatStepHandler(org.orekit.propagation.sampling.MultiSatStepHandler) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Orbit(org.orekit.orbits.Orbit) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) PVCoordinates(org.orekit.utils.PVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) PositionAngle(org.orekit.orbits.PositionAngle) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FastMath(org.hipparchus.util.FastMath) FieldBoundedPropagator(org.orekit.propagation.FieldBoundedPropagator) Utils(org.orekit.Utils) Before(org.junit.Before) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Constants(org.orekit.utils.Constants) DateComponents(org.orekit.time.DateComponents) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PropagatorsParallelizer(org.orekit.propagation.PropagatorsParallelizer) FramesFactory(org.orekit.frames.FramesFactory) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test) LofOffset(org.orekit.attitudes.LofOffset) Field(org.hipparchus.Field) InertialProvider(org.orekit.attitudes.InertialProvider) OrekitException(org.orekit.errors.OrekitException) RealFieldElement(org.hipparchus.RealFieldElement) CelestialBodyPointed(org.orekit.attitudes.CelestialBodyPointed) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) Decimal64Field(org.hipparchus.util.Decimal64Field) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) TimeComponents(org.orekit.time.TimeComponents) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PropagatorsParallelizer(org.orekit.propagation.PropagatorsParallelizer) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) MultiSatStepHandler(org.orekit.propagation.sampling.MultiSatStepHandler)

Example 25 with AttitudeProvider

use of org.orekit.attitudes.AttitudeProvider in project Orekit by CS-SI.

the class PolynomialParametricAccelerationTest method testEquivalentTangentialOverriddenManeuverField.

@Test
public void testEquivalentTangentialOverriddenManeuverField() 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 PolynomialParametricAcceleration lofAcceleration = new PolynomialParametricAcceleration(Vector3D.PLUS_I, maneuverLaw, "prefix", null, 0);
    lofAcceleration.getParametersDrivers()[0].setValue(f / mass);
    doTestEquivalentManeuver(Decimal64Field.getInstance(), mass, maneuverLaw, maneuver, accelerationLaw, lofAcceleration, 1.0e-15);
}
Also used : CelestialBodyPointed(org.orekit.attitudes.CelestialBodyPointed) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Aggregations

AttitudeProvider (org.orekit.attitudes.AttitudeProvider)36 Test (org.junit.Test)29 AbsoluteDate (org.orekit.time.AbsoluteDate)21 LofOffset (org.orekit.attitudes.LofOffset)20 SpacecraftState (org.orekit.propagation.SpacecraftState)17 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)16 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)15 ConstantThrustManeuver (org.orekit.forces.maneuvers.ConstantThrustManeuver)15 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)14 InertialProvider (org.orekit.attitudes.InertialProvider)13 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)12 Orbit (org.orekit.orbits.Orbit)12 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)10 OrekitException (org.orekit.errors.OrekitException)10 CartesianOrbit (org.orekit.orbits.CartesianOrbit)10 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)9 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)8 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)8 DateComponents (org.orekit.time.DateComponents)8