diff --git a/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java b/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java index c42378b6cd141c5ff0f020231c7ab54e6a9ba596..93f4fc327349ec2dd43b580a17e456aa66684df0 100644 --- a/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java +++ b/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java @@ -44,6 +44,7 @@ import org.orekit.utils.TimeStampedPVCoordinates; * axis is the rotation or polar axis.

* @author Luc Maisonobe + * @author Guylaine Prat */ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape { @@ -88,6 +89,15 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape { * WGS84 * {@link org.orekit.utils.Constants#WGS84_EARTH_EQUATORIAL_RADIUS Constants.WGS84_EARTH_EQUATORIAL_RADIUS} * {@link org.orekit.utils.Constants#WGS84_EARTH_FLATTENING Constants.WGS84_EARTH_FLATTENING} + * IERS96 + * {@link org.orekit.utils.Constants#IERS96_EARTH_EQUATORIAL_RADIUS Constants.IERS96_EARTH_EQUATORIAL_RADIUS} + * {@link org.orekit.utils.Constants#IERS96_EARTH_FLATTENING Constants.IERS96_EARTH_FLATTENING} + * IERS2003 + * {@link org.orekit.utils.Constants#IERS2003_EARTH_EQUATORIAL_RADIUS Constants.IERS2003_EARTH_EQUATORIAL_RADIUS} + * {@link org.orekit.utils.Constants#IERS2003_EARTH_FLATTENING Constants.IERS2003_EARTH_FLATTENING} + * IERS2010 + * {@link org.orekit.utils.Constants#IERS2010_EARTH_EQUATORIAL_RADIUS Constants.IERS2010_EARTH_EQUATORIAL_RADIUS} + * {@link org.orekit.utils.Constants#IERS2010_EARTH_FLATTENING Constants.IERS2010_EARTH_FLATTENING} * * @param ae equatorial radius * @param f the flattening (f = (a-b)/a) diff --git a/src/main/java/org/orekit/models/earth/ReferenceEllipsoid.java b/src/main/java/org/orekit/models/earth/ReferenceEllipsoid.java index a1e6120605128b9b98e81778d2e17e42cba30d2f..c9b193eeb2db3b947af7ec4ada5655dcf84c52de 100644 --- a/src/main/java/org/orekit/models/earth/ReferenceEllipsoid.java +++ b/src/main/java/org/orekit/models/earth/ReferenceEllipsoid.java @@ -51,6 +51,7 @@ import org.orekit.utils.Constants; * Third Edition, Amendment 1. * * @author Evan Ward + * @author Guylaine Prat */ public class ReferenceEllipsoid extends OneAxisEllipsoid implements EarthShape { @@ -242,4 +243,42 @@ public class ReferenceEllipsoid extends OneAxisEllipsoid implements EarthShape { ); } + /** + * Get the IERS96 ellipsoid, attached to the given body frame. + * + * @param bodyFrame the earth centered fixed frame + * @return an IERS96 reference ellipsoid + */ + public static ReferenceEllipsoid getIers96(final Frame bodyFrame) { + return new ReferenceEllipsoid(Constants.IERS96_EARTH_EQUATORIAL_RADIUS, + Constants.IERS96_EARTH_FLATTENING, bodyFrame, + Constants.IERS96_EARTH_MU, + Constants.IERS96_EARTH_ANGULAR_VELOCITY); + } + + /** + * Get the IERS2003 ellipsoid, attached to the given body frame. + * + * @param bodyFrame the earth centered fixed frame + * @return an IERS2003 reference ellipsoid + */ + public static ReferenceEllipsoid getIers2003(final Frame bodyFrame) { + return new ReferenceEllipsoid(Constants.IERS2003_EARTH_EQUATORIAL_RADIUS, + Constants.IERS2003_EARTH_FLATTENING, bodyFrame, + Constants.IERS2003_EARTH_MU, + Constants.IERS2003_EARTH_ANGULAR_VELOCITY); + } + + /** + * Get the IERS2010 ellipsoid, attached to the given body frame. + * + * @param bodyFrame the earth centered fixed frame + * @return an IERS2010 reference ellipsoid + */ + public static ReferenceEllipsoid getIers2010(final Frame bodyFrame) { + return new ReferenceEllipsoid(Constants.IERS2010_EARTH_EQUATORIAL_RADIUS, + Constants.IERS2010_EARTH_FLATTENING, bodyFrame, + Constants.IERS2010_EARTH_MU, + Constants.IERS2010_EARTH_ANGULAR_VELOCITY); + } } diff --git a/src/test/java/org/orekit/models/earth/ReferenceEllipsoidTest.java b/src/test/java/org/orekit/models/earth/ReferenceEllipsoidTest.java index 65bf3fb40987bba09820b546cea5baf48cac6937..543eaa49ecc3985de62c953f68069664000621ba 100644 --- a/src/test/java/org/orekit/models/earth/ReferenceEllipsoidTest.java +++ b/src/test/java/org/orekit/models/earth/ReferenceEllipsoidTest.java @@ -34,6 +34,7 @@ import org.orekit.utils.Constants; * Unit tests for {@link ReferenceEllipsoid}. * * @author E. Ward + * @author G. Prat */ public class ReferenceEllipsoidTest { @@ -138,7 +139,6 @@ public class ReferenceEllipsoidTest { Frame frame = FramesFactory.getGCRF(); // action - ReferenceEllipsoid wgs84 = ReferenceEllipsoid.getWgs84(frame); // verify @@ -147,6 +147,78 @@ public class ReferenceEllipsoidTest { assertThat(wgs84.getBodyFrame(), is(frame)); } + /** + * check {@link ReferenceEllipsoid#getGrs80(Frame)} + */ + @Test + public void testGetGrs80() { + // setup + double c20factor = GravityFieldFactory.getUnnormalizationFactors(2, 0)[2][0]; + Frame frame = FramesFactory.getGCRF(); + + // action + ReferenceEllipsoid grs80 = ReferenceEllipsoid.getGrs80(frame); + + // verify + Assert.assertEquals( + grs80.getC2n0(1), Constants.GRS80_EARTH_C20 / c20factor, 3e-9); + assertThat(grs80.getBodyFrame(), is(frame)); + } + + /** + * check {@link ReferenceEllipsoid#getIers96(Frame)} + */ + @Test + public void testGetIers96() { + // setup + double c20factor = GravityFieldFactory.getUnnormalizationFactors(2, 0)[2][0]; + Frame frame = FramesFactory.getGCRF(); + + // action + ReferenceEllipsoid iers96 = ReferenceEllipsoid.getIers96(frame); + + // verify + Assert.assertEquals( + iers96.getC2n0(1), Constants.IERS96_EARTH_C20 / c20factor, 3e-9); + assertThat(iers96.getBodyFrame(), is(frame)); + } + + /** + * check {@link ReferenceEllipsoid#getIers2003(Frame)} + */ + @Test + public void testGetIers2003() { + // setup + double c20factor = GravityFieldFactory.getUnnormalizationFactors(2, 0)[2][0]; + Frame frame = FramesFactory.getGCRF(); + + // action + ReferenceEllipsoid iers2003 = ReferenceEllipsoid.getIers2003(frame); + + // verify + Assert.assertEquals( + iers2003.getC2n0(1), Constants.IERS2003_EARTH_C20 / c20factor, 3e-9); + assertThat(iers2003.getBodyFrame(), is(frame)); + } + + /** + * check {@link ReferenceEllipsoid#getIers2010(Frame)} + */ + @Test + public void testGetIers2010() { + // setup + double c20factor = GravityFieldFactory.getUnnormalizationFactors(2, 0)[2][0]; + Frame frame = FramesFactory.getGCRF(); + + // action + ReferenceEllipsoid iers2010 = ReferenceEllipsoid.getIers2010(frame); + + // verify + Assert.assertEquals( + iers2010.getC2n0(1), Constants.IERS2010_EARTH_C20 / c20factor, 3e-9); + assertThat(iers2010.getBodyFrame(), is(frame)); + } + /** check {@link ReferenceEllipsoid#getEllipsoid()} */ @Test public void testGetEllipsoid() {