Search in sources :

Example 1 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation 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 2 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation 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 3 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation 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)

Example 4 with Rotation

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

the class PolynomialParametricAccelerationTest 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 PolynomialParametricAcceleration inertialAcceleration = new PolynomialParametricAcceleration(direction, true, "", AbsoluteDate.J2000_EPOCH, 0);
    inertialAcceleration.getParametersDrivers()[0].setValue(f / mass);
    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)

Example 5 with Rotation

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

the class DTM2000Test method testNonEarthRotationAxisAlignedFrame.

@Test
public void testNonEarthRotationAxisAlignedFrame() throws OrekitException {
    // setup
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Rotation rotation = new Rotation(Vector3D.PLUS_I, FastMath.PI / 2, RotationConvention.VECTOR_OPERATOR);
    Frame frame = new Frame(ecef, new Transform(date, rotation), "other");
    Vector3D pEcef = new Vector3D(6378137 + 300e3, 0, 0);
    Vector3D pFrame = ecef.getTransformTo(frame, date).transformPosition(pEcef);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.460, 1.0 / 298.257222101, ecef);
    SolarInputs97to05 in = SolarInputs97to05.getInstance();
    earth.setAngularThreshold(1e-10);
    DTM2000 atm = new DTM2000(in, sun, earth);
    // action
    final double actual = atm.getDensity(date, pFrame, frame);
    // verify
    Assert.assertEquals(atm.getDensity(date, pEcef, ecef), actual, 0.0);
}
Also used : Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) SolarInputs97to05(org.orekit.SolarInputs97to05) Transform(org.orekit.frames.Transform) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)145 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)116 Test (org.junit.Test)100 AbsoluteDate (org.orekit.time.AbsoluteDate)55 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)53 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)43 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)38 PVCoordinates (org.orekit.utils.PVCoordinates)30 SpacecraftState (org.orekit.propagation.SpacecraftState)26 DateComponents (org.orekit.time.DateComponents)22 Frame (org.orekit.frames.Frame)21 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)21 RandomGenerator (org.hipparchus.random.RandomGenerator)19 Transform (org.orekit.frames.Transform)19 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)19 CircularOrbit (org.orekit.orbits.CircularOrbit)18 TimeComponents (org.orekit.time.TimeComponents)17 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)16 GeodeticPoint (org.orekit.bodies.GeodeticPoint)15 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)14