Search in sources :

Example 1 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 2 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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));
}
Also used : Frame(org.orekit.frames.Frame) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) CelestialBody(org.orekit.bodies.CelestialBody) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 3 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.

the class BoxAndSolarArraySpacecraftTest method testNormalSunAlignedDouble.

@Test
public void testNormalSunAlignedDouble() throws OrekitException {
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, (date, frame) -> new TimeStampedPVCoordinates(date, new Vector3D(0, 1e6, 0), Vector3D.ZERO), 20.0, Vector3D.PLUS_J, 0.0, 1.0, 0.0);
    Vector3D normal = s.getNormal(AbsoluteDate.J2000_EPOCH, FramesFactory.getEME2000(), Vector3D.ZERO, Rotation.IDENTITY);
    Assert.assertEquals(0, Vector3D.dotProduct(normal, Vector3D.PLUS_J), 1.0e-16);
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Test(org.junit.Test)

Example 4 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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);
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Example 5 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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);
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) ConstantThrustManeuver(org.orekit.forces.maneuvers.ConstantThrustManeuver) Test(org.junit.Test)

Aggregations

Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)750 Test (org.junit.Test)466 AbsoluteDate (org.orekit.time.AbsoluteDate)323 PVCoordinates (org.orekit.utils.PVCoordinates)280 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)259 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)187 SpacecraftState (org.orekit.propagation.SpacecraftState)152 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)124 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)119 Frame (org.orekit.frames.Frame)115 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)105 Orbit (org.orekit.orbits.Orbit)100 GeodeticPoint (org.orekit.bodies.GeodeticPoint)84 OrekitException (org.orekit.errors.OrekitException)83 CartesianOrbit (org.orekit.orbits.CartesianOrbit)75 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)68 DateComponents (org.orekit.time.DateComponents)67 Transform (org.orekit.frames.Transform)61 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)59 CircularOrbit (org.orekit.orbits.CircularOrbit)59