use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class EquinoctialOrbitTest method testNumericalIssue25.
@Test
public void testNumericalIssue25() throws OrekitException {
Vector3D position = new Vector3D(3782116.14107698, 416663.11924914, 5875541.62103057);
Vector3D velocity = new Vector3D(-6349.7848910501, 288.4061811651, 4066.9366759691);
EquinoctialOrbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), new AbsoluteDate("2004-01-01T23:00:00.000", TimeScalesFactory.getUTC()), 3.986004415E14);
Assert.assertEquals(0.0, orbit.getE(), 2.0e-14);
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class EquinoctialOrbitTest method testAnomaly.
@Test
public void testAnomaly() {
// elliptic orbit
Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6);
Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
EquinoctialOrbit p = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
KeplerianOrbit kep = new KeplerianOrbit(p);
double e = p.getE();
double eRatio = FastMath.sqrt((1 - e) / (1 + e));
double paPraan = kep.getPerigeeArgument() + kep.getRightAscensionOfAscendingNode();
double lv = 1.1;
// formulations for elliptic case
double lE = 2 * FastMath.atan(eRatio * FastMath.tan((lv - paPraan) / 2)) + paPraan;
double lM = lE - e * FastMath.sin(lE - paPraan);
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lv, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), 0, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lE, PositionAngle.ECCENTRIC, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), 0, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lM, PositionAngle.MEAN, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
// circular orbit
p = new EquinoctialOrbit(p.getA(), 0, 0, p.getHx(), p.getHy(), p.getLv(), PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
lE = lv;
lM = lE;
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lv, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), 0, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lE, PositionAngle.ECCENTRIC, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), 0, PositionAngle.TRUE, p.getFrame(), p.getDate(), p.getMu());
p = new EquinoctialOrbit(p.getA(), p.getEquinoctialEx(), p.getEquinoctialEy(), p.getHx(), p.getHy(), lM, PositionAngle.MEAN, p.getFrame(), p.getDate(), p.getMu());
Assert.assertEquals(p.getLv(), lv, Utils.epsilonAngle * FastMath.abs(lv));
Assert.assertEquals(p.getLE(), lE, Utils.epsilonAngle * FastMath.abs(lE));
Assert.assertEquals(p.getLM(), lM, Utils.epsilonAngle * FastMath.abs(lM));
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class EquinoctialOrbitTest method testEquatorialRetrograde.
@Test
public void testEquatorialRetrograde() {
Vector3D position = new Vector3D(10000000.0, 0.0, 0.0);
Vector3D velocity = new Vector3D(0.0, -6500.0, 0.0);
double r2 = position.getNormSq();
double r = FastMath.sqrt(r2);
Vector3D acceleration = new Vector3D(-mu / (r * r2), position, 1, new Vector3D(-0.1, 0.2, 0.3));
PVCoordinates pvCoordinates = new PVCoordinates(position, velocity, acceleration);
// we use an intermediate Keplerian orbit so eccentricity can be computed
// when using directly PV, eccentricity ends up in NaN, due to the way computation is organized
// this is not really considered a problem as anyway retrograde equatorial cannot be fully supported
EquinoctialOrbit orbit = new EquinoctialOrbit(new KeplerianOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu));
Assert.assertEquals(10637829.465, orbit.getA(), 1.0e-3);
Assert.assertEquals(-738.145, orbit.getADot(), 1.0e-3);
Assert.assertEquals(0.05995861, orbit.getE(), 1.0e-8);
Assert.assertEquals(-6.523e-5, orbit.getEDot(), 1.0e-8);
Assert.assertTrue(Double.isNaN(orbit.getI()));
Assert.assertTrue(Double.isNaN(orbit.getIDot()));
Assert.assertTrue(Double.isNaN(orbit.getHx()));
Assert.assertTrue(Double.isNaN(orbit.getHxDot()));
Assert.assertTrue(Double.isNaN(orbit.getHy()));
Assert.assertTrue(Double.isNaN(orbit.getHyDot()));
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class EquinoctialOrbitTest method testEquinoctialToEquinoctialEll.
@Test
public void testEquinoctialToEquinoctialEll() {
double ix = 1.200e-04;
double iy = -1.16e-04;
double inc = 2 * FastMath.asin(FastMath.sqrt((ix * ix + iy * iy) / 4.));
double hx = FastMath.tan(inc / 2.) * ix / (2 * FastMath.sin(inc / 2.));
double hy = FastMath.tan(inc / 2.) * iy / (2 * FastMath.sin(inc / 2.));
// elliptic orbit
EquinoctialOrbit equi = new EquinoctialOrbit(42166.712, 0.5, -0.5, hx, hy, 5.300, PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
Vector3D pos = equi.getPVCoordinates().getPosition();
Vector3D vit = equi.getPVCoordinates().getVelocity();
PVCoordinates pvCoordinates = new PVCoordinates(pos, vit);
EquinoctialOrbit param = new EquinoctialOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu);
Assert.assertEquals(param.getA(), equi.getA(), Utils.epsilonTest * equi.getA());
Assert.assertEquals(param.getEquinoctialEx(), equi.getEquinoctialEx(), Utils.epsilonE * FastMath.abs(equi.getE()));
Assert.assertEquals(param.getEquinoctialEy(), equi.getEquinoctialEy(), Utils.epsilonE * FastMath.abs(equi.getE()));
Assert.assertEquals(param.getHx(), equi.getHx(), Utils.epsilonAngle * FastMath.abs(equi.getI()));
Assert.assertEquals(param.getHy(), equi.getHy(), Utils.epsilonAngle * FastMath.abs(equi.getI()));
Assert.assertEquals(MathUtils.normalizeAngle(param.getLv(), equi.getLv()), equi.getLv(), Utils.epsilonAngle * FastMath.abs(equi.getLv()));
}
use of org.orekit.utils.PVCoordinates in project Orekit by CS-SI.
the class EquinoctialOrbitTest method testToString.
@Test
public void testToString() {
Vector3D position = new Vector3D(-29536113.0, 30329259.0, -100125.0);
Vector3D velocity = new Vector3D(-2194.0, -2141.0, -8.0);
PVCoordinates pvCoordinates = new PVCoordinates(position, velocity);
EquinoctialOrbit orbit = new EquinoctialOrbit(pvCoordinates, FramesFactory.getEME2000(), date, mu);
Assert.assertEquals("equinoctial parameters: {a: 4.225517000282565E7; ex: 5.927324978565528E-4; ey: -0.002062743969643666; hx: 6.401103130239252E-5; hy: -0.0017606836670756732; lv: 134.24111947709974;}", orbit.toString());
}
Aggregations