Commit 211f2189 authored by Luc Maisonobe's avatar Luc Maisonobe

Improved test coverage.

parent 1384536e
......@@ -760,7 +760,11 @@ public class FieldCircularOrbit<T extends RealFieldElement<T>>
* @param mu central attraction coefficient (m³/s²)
* @param <T> type of the fiels elements
* @return position vector
* @deprecated as of 9.3, replaced by {@link #FieldCircularOrbit(RealFieldElement, RealFieldElement,
* RealFieldElement, RealFieldElement, RealFieldElement, RealFieldElement, PositionAngle, Frame,
* FieldAbsoluteDate, double)} and {@link #getPVCoordinates()}
*/
@Deprecated
public static <T extends RealFieldElement<T>> FieldVector3D<T> circularToPosition(final T a, final T ex, final T ey,
final T i, final T raan, final T alphaV,
final double mu) {
......
......@@ -634,9 +634,13 @@ public class FieldEquinoctialOrbit<T extends RealFieldElement<T>> extends FieldO
* @param hy tan(i/2) sin(Ω), second component of inclination vector
* @param lv v + ω + Ω true longitude argument (rad)
* @param mu central attraction coefficient (m³/s²)
* @param <T> type of the fiels elements
* @param <T> type of the field elements
* @return position vector
* @deprecated as of 9.3, replaced by {@link #FieldEquinoctialOrbit(RealFieldElement, RealFieldElement,
* RealFieldElement, RealFieldElement, RealFieldElement, RealFieldElement, PositionAngle, Frame,
* FieldAbsoluteDate, double)} and {@link #getPVCoordinates()}
*/
@Deprecated
public static <T extends RealFieldElement<T>> FieldVector3D<T> equinoctialToPosition(final T a, final T ex, final T ey,
final T hx, final T hy, final T lv,
final double mu) {
......
......@@ -873,7 +873,11 @@ public class FieldKeplerianOrbit<T extends RealFieldElement<T>> extends FieldOrb
* @param mu central attraction coefficient (m³/s²)
* @param <T> type of the fiels elements
* @return position vector
* @deprecated as of 9.3 replaced with {@link #FieldKeplerianOrbit(RealFieldElement, RealFieldElement,
* RealFieldElement, RealFieldElement, RealFieldElement, RealFieldElement, PositionAngle, Frame,
* FieldAbsoluteDate, double)} and {@#getPVCoordinates()}
*/
@Deprecated
public static <T extends RealFieldElement<T>> FieldVector3D<T> ellipticKeplerianToPosition(final T a, final T e, final T i,
final T pa, final T raan, final T v,
final double mu) {
......@@ -919,7 +923,11 @@ public class FieldKeplerianOrbit<T extends RealFieldElement<T>> extends FieldOrb
* @param mu central attraction coefficient (m³/s²)
* @param <T> type of the fiels elements
* @return position vector
* @deprecated as of 9.3 replaced with {@link #FieldKeplerianOrbit(RealFieldElement, RealFieldElement,
* RealFieldElement, RealFieldElement, RealFieldElement, RealFieldElement, PositionAngle, Frame,
* FieldAbsoluteDate, double)} and {@#getPVCoordinates()}
*/
@Deprecated
public static <T extends RealFieldElement<T>> FieldVector3D<T> hyperbolicKeplerianToPosition(final T a, final T e, final T i,
final T pa, final T raan, final T v,
final double mu) {
......
......@@ -93,6 +93,12 @@ public class FieldCircularOrbitTest {
doTestCircularToCartesian(Decimal64Field.getInstance());
}
@Test
@Deprecated
public void testCircToCart2() {
doTestCircularToCartesian2(Decimal64Field.getInstance());
}
@Test
public void testCircToKepl() {
doTestCircularToKeplerian(Decimal64Field.getInstance());
......@@ -422,6 +428,36 @@ public class FieldCircularOrbitTest {
}
@Deprecated
private <T extends RealFieldElement<T>> void doTestCircularToCartesian2(Field<T> field) {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
T ix = zero.add(1.200e-04);
T iy = zero.add(-1.16e-04);
T i = ix.multiply(ix).add(iy.multiply(iy)).divide(4).sqrt().asin().multiply(2);
T raan = iy.atan2(ix);
T cosRaan = raan.cos();
T sinRaan = raan.sin();
T exTilde = zero.add(-7.900e-6);
T eyTilde = zero.add(1.100e-4);
T ex = exTilde.multiply(cosRaan).add(eyTilde.multiply(sinRaan));
T ey = eyTilde.multiply(cosRaan).subtract(exTilde.multiply(sinRaan));
FieldCircularOrbit<T> circ=
new FieldCircularOrbit<>(zero.add(42166.712), ex, ey, i, raan,
raan.negate().add(5.300), PositionAngle.MEAN,
FramesFactory.getEME2000(), date, mu);
FieldVector3D<T> ref = circ.getPVCoordinates().getPosition();
FieldVector3D<T> pos = FieldCircularOrbit.circularToPosition(circ.getA(),
circ.getCircularEx(), circ.getCircularEy(),
circ.getI(), circ.getRightAscensionOfAscendingNode(),
circ.getAlphaV(),
circ.getMu());
Assert.assertEquals(0, FieldVector3D.distance(ref, pos).getReal(), 1.0e-15);
}
private <T extends RealFieldElement<T>> void doTestCircularToKeplerian(Field<T> field) {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
......
......@@ -79,6 +79,12 @@ public class FieldEquinoctialOrbitTest {
doTestEquinoctialToCartesian(Decimal64Field.getInstance());
}
@Test
@Deprecated
public void testEquinoctialToCartesian2() {
doTestEquinoctialToCartesian2(Decimal64Field.getInstance());
}
@Test
public void testEquinoctialToKeplerian() {
doTestEquinoctialToKeplerian(Decimal64Field.getInstance());
......@@ -298,6 +304,30 @@ public class FieldEquinoctialOrbitTest {
* FastMath.abs(vit.getZ().getReal()));
}
@Deprecated
private <T extends RealFieldElement<T>> void doTestEquinoctialToCartesian2(Field<T> field) {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
T ix = zero.add(1.200e-04);
T iy = zero.add(-1.16e-04);
T inc = ix.multiply(ix).add(iy.multiply(iy)).divide(4.).sqrt().asin().multiply(2);
T hx = inc.divide(2.).tan().multiply(ix).divide(inc.divide(2.).sin().multiply(2));
T hy = inc.divide(2.).tan().multiply(iy).divide(inc.divide(2.).sin().multiply(2));
FieldEquinoctialOrbit<T> equi =
new FieldEquinoctialOrbit<>(zero.add(42166.712), zero.add(-7.900e-06), zero.add(1.100e-04), hx, hy,
zero.add(5.300), PositionAngle.MEAN,
FramesFactory.getEME2000(), date, mu);
FieldVector3D<T> ref = equi.getPVCoordinates().getPosition();
FieldVector3D<T> pos = FieldEquinoctialOrbit.equinoctialToPosition(equi.getA(),
equi.getEquinoctialEx(), equi.getEquinoctialEy(),
equi.getHx(), equi.getHy(),
equi.getLv(),
equi.getMu());
Assert.assertEquals(0, FieldVector3D.distance(ref, pos).getReal(), 1.0e-15);
}
private <T extends RealFieldElement<T>> void doTestEquinoctialToKeplerian(Field<T> field) {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
......
......@@ -66,6 +66,12 @@ public class FieldKeplerianOrbitTest {
doTestKeplerianToCartesian(Decimal64Field.getInstance());
}
@Test
@Deprecated
public void testKepToCart2() {
doTestKeplerianToCartesian2(Decimal64Field.getInstance());
}
@Test
public void testKepToEquin() {
doTestKeplerianToEquinoctial(Decimal64Field.getInstance());
......@@ -111,6 +117,12 @@ public class FieldKeplerianOrbitTest {
doTestHyperbola2(Decimal64Field.getInstance());
}
@Test
@Deprecated
public void testHyperbola3() {
doTestHyperbola3(Decimal64Field.getInstance());
}
@Test
public void testToOrbitWithoutDerivatives() {
doTestToOrbitWithoutDerivatives(Decimal64Field.getInstance());
......@@ -357,6 +369,32 @@ public class FieldKeplerianOrbitTest {
Assert.assertEquals(-0.118801577532701e+04, vit.getZ().getReal(), Utils.epsilonTest * FastMath.abs(vit.getZ().getReal()));
}
@Deprecated
private <T extends RealFieldElement<T>> void doTestKeplerianToCartesian2(final Field<T> field) {
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
T a= field.getZero().add(24464560.0);
T e= field.getZero().add(0.7311);
T i= field.getZero().add(0.122138);
T pa= field.getZero().add(3.10686);
T raan= field.getZero().add(1.00681);
T anomaly= field.getZero().add(0.048363);
// elliptic orbit
FieldKeplerianOrbit<T> kep =
new FieldKeplerianOrbit<>(a, e, i, pa, raan, anomaly, PositionAngle.MEAN,
FramesFactory.getEME2000(), date, mu);
FieldVector3D<T> ref = kep.getPVCoordinates().getPosition();
FieldVector3D<T> pos = FieldKeplerianOrbit.ellipticKeplerianToPosition(kep.getA(), kep.getE(), kep.getI(),
kep.getPerigeeArgument(),
kep.getRightAscensionOfAscendingNode(),
kep.getTrueAnomaly(),
kep.getMu());
Assert.assertEquals(0, FieldVector3D.distance(ref, pos).getReal(), 1.0e-15);
}
private <T extends RealFieldElement<T>> void doTestKeplerianToEquinoctial(final Field<T> field) {
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
T a= field.getZero().add(24464560.0);
......@@ -740,6 +778,23 @@ public class FieldKeplerianOrbitTest {
}
}
@Deprecated
private <T extends RealFieldElement<T>> void doTestHyperbola3(final Field<T> field) {
T zero = field.getZero();
FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(-10000000.0), zero.add(1.2), zero.add(0.3),
zero, zero, zero.add(-1.75),
PositionAngle.MEAN,
FramesFactory.getEME2000(), new FieldAbsoluteDate<>(field),
mu);
FieldVector3D<T> ref = orbit.getPVCoordinates().getPosition();
FieldVector3D<T> pos = FieldKeplerianOrbit.hyperbolicKeplerianToPosition(orbit.getA(), orbit.getE(), orbit.getI(),
orbit.getPerigeeArgument(),
orbit.getRightAscensionOfAscendingNode(),
orbit.getTrueAnomaly(),
orbit.getMu());
Assert.assertEquals(0, FieldVector3D.distance(ref, pos).getReal(), 1.0e-15);
}
private <T extends RealFieldElement<T>> void doTestToOrbitWithoutDerivatives(Field<T> field) {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment