use of org.orekit.propagation.PropagatorsParallelizer in project Orekit by CS-SI.
the class Model method value.
/**
* {@inheritDoc}
*/
@Override
public Pair<RealVector, RealMatrix> value(final RealVector point) throws OrekitExceptionWrapper {
try {
// Set up the propagators parallelizer
final NumericalPropagator[] propagators = createPropagators(point);
final Orbit[] orbits = new Orbit[propagators.length];
for (int i = 0; i < propagators.length; ++i) {
mappers[i] = configureDerivatives(propagators[i]);
orbits[i] = propagators[i].getInitialState().getOrbit();
}
final PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(Arrays.asList(propagators), configureMeasurements(point));
// Reset value and Jacobian
evaluations.clear();
value.set(0.0);
for (int i = 0; i < jacobian.getRowDimension(); ++i) {
for (int j = 0; j < jacobian.getColumnDimension(); ++j) {
jacobian.setEntry(i, j, 0.0);
}
}
// Run the propagation, gathering residuals on the fly
if (forwardPropagation) {
// Propagate forward from firstDate
parallelizer.propagate(firstDate.shiftedBy(-1.0), lastDate.shiftedBy(+1.0));
} else {
// Propagate backward from lastDate
parallelizer.propagate(lastDate.shiftedBy(+1.0), firstDate.shiftedBy(-1.0));
}
observer.modelCalled(orbits, evaluations);
return new Pair<RealVector, RealMatrix>(value, jacobian);
} catch (OrekitException oe) {
throw new OrekitExceptionWrapper(oe);
}
}
use of org.orekit.propagation.PropagatorsParallelizer 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));
}
use of org.orekit.propagation.PropagatorsParallelizer 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));
}
Aggregations