use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testOnlyLiftWithoutReflection.
@Test
public void testOnlyLiftWithoutReflection() throws OrekitException {
AbsoluteDate initialDate = propagator.getInitialState().getDate();
CelestialBody sun = CelestialBodyFactory.getSun();
BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J, 1.0, 1.0, 1.0, 0.0);
Vector3D earthRot = new Vector3D(0.0, 0.0, 7.292115e-4);
for (double dt = 0; dt < 4000; dt += 60) {
AbsoluteDate date = initialDate.shiftedBy(dt);
SpacecraftState state = propagator.propagate(date);
// simple Earth fixed atmosphere
Vector3D p = state.getPVCoordinates().getPosition();
Vector3D v = state.getPVCoordinates().getVelocity();
Vector3D vAtm = Vector3D.crossProduct(earthRot, p);
Vector3D relativeVelocity = vAtm.subtract(v);
Vector3D drag = s.dragAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), 0.001, relativeVelocity, getDragParameters(s));
Assert.assertTrue(Vector3D.angle(relativeVelocity, drag) > 0.167);
Assert.assertTrue(Vector3D.angle(relativeVelocity, drag) < 0.736);
Vector3D sunDirection = sun.getPVCoordinates(date, state.getFrame()).getPosition().normalize();
Vector3D flux = new Vector3D(-4.56e-6, sunDirection);
Vector3D radiation = s.radiationPressureAcceleration(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), flux, getRadiationParameters(s));
Assert.assertEquals(0.0, Vector3D.angle(flux, radiation), 1.0e-9);
}
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class BoxAndSolarArraySpacecraftTest method testLiftVsNoLift.
@Test
public void testLiftVsNoLift() throws OrekitException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
CelestialBody sun = CelestialBodyFactory.getSun();
// older implementation did not consider lift, so it really worked
// only for symmetrical shapes. For testing purposes, we will use a
// basic cubic shape without solar arrays and a relative atmosphere
// velocity either *exactly* facing a side or *exactly* along a main diagonal
BoxAndSolarArraySpacecraft.Facet[] facets = new BoxAndSolarArraySpacecraft.Facet[] { new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_I, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_J, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.MINUS_K, 3.0), new BoxAndSolarArraySpacecraft.Facet(Vector3D.PLUS_K, 3.0) };
BoxAndSolarArraySpacecraft cube = new BoxAndSolarArraySpacecraft(facets, sun, 0.0, Vector3D.PLUS_J, 1.0, 1.0, 1.0, 0.0);
AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
Frame frame = FramesFactory.getEME2000();
Vector3D position = new Vector3D(1234567.8, 9876543.21, 121212.3434);
double mass = 1000.0;
double density = 0.001;
Rotation rotation = Rotation.IDENTITY;
// head-on, there acceleration with lift should be twice acceleration without lift
Vector3D headOnVelocity = new Vector3D(2000, 0.0, 0.0);
Vector3D newHeadOnDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, headOnVelocity, getDragParameters(cube));
Vector3D oldHeadOnDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, headOnVelocity);
Assert.assertThat(newHeadOnDrag, OrekitMatchers.vectorCloseTo(oldHeadOnDrag.scalarMultiply(2), 1));
// on an angle, the no lift implementation applies drag to the velocity direction
// instead of to the facet normal direction. In the symmetrical case, this implies
// it applied a single cos(θ) coefficient (projected surface reduction) instead
// of using cos²(θ) (projected surface reduction *and* normal component projection)
// and since molecule is reflected backward with the same velocity, this implies a
// factor 2 in linear momentum differences
Vector3D diagonalVelocity = new Vector3D(2000, 2000, 2000);
Vector3D newDiagDrag = cube.dragAcceleration(date, frame, position, rotation, mass, density, diagonalVelocity, getDragParameters(cube));
Vector3D oldDiagDrag = oldDragAcceleration(cube, date, frame, position, rotation, mass, density, diagonalVelocity);
double oldMissingCoeff = 2.0 / FastMath.sqrt(3.0);
Vector3D fixedOldDrag = new Vector3D(oldMissingCoeff, oldDiagDrag);
Assert.assertThat(newDiagDrag, OrekitMatchers.vectorCloseTo(fixedOldDrag, 1));
}
use of org.orekit.time.AbsoluteDate 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);
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class PolynomialParametricAccelerationTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
final double a = 24396159;
final double e = 0.72831215;
final double i = FastMath.toRadians(7);
final double omega = FastMath.toRadians(180);
final double OMEGA = FastMath.toRadians(261);
final double lv = 0;
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
initialOrbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, Constants.EIGEN5C_EARTH_MU);
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.
the class DragForceTest method testStateJacobianSphere.
@Test
public void testStateJacobianSphere() throws OrekitException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
double i = FastMath.toRadians(98.7);
double omega = FastMath.toRadians(93.0);
double OMEGA = FastMath.toRadians(15.0 * 22.5);
Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
OrbitType integrationType = OrbitType.CARTESIAN;
double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, integrationType);
NumericalPropagator propagator = new NumericalPropagator(new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
propagator.setOrbitType(integrationType);
final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new IsotropicDrag(2.5, 1.2));
propagator.addForceModel(forceModel);
SpacecraftState state0 = new SpacecraftState(orbit);
checkStateJacobian(propagator, state0, date.shiftedBy(3.5 * 3600.0), 1e3, tolerances[0], 2.0e-8);
}
Aggregations