From bdba7cc968f384f7fc5a1a0b22c0ec24c3051019 Mon Sep 17 00:00:00 2001 From: Guylaine Prat Date: Mon, 26 Aug 2019 15:51:00 +0200 Subject: [PATCH] Add uses of IERS 96, 2003 and 2010 Earth constants Related to issue #593 --- .../org/orekit/bodies/OneAxisEllipsoid.java | 10 +++ .../models/earth/ReferenceEllipsoid.java | 39 ++++++++++ .../models/earth/ReferenceEllipsoidTest.java | 74 ++++++++++++++++++- 3 files changed, 122 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java b/src/main/java/org/orekit/bodies/OneAxisEllipsoid.java index c42378b6c..93f4fc327 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 a1e612060..c9b193eeb 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 65bf3fb40..543eaa49e 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() { -- GitLab