use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class DSSTPropagation method setForceModel.
/**
* Set DSST propagator force models
*
* @param parser input file parser
* @param unnormalized spherical harmonics provider
* @param earthFrame Earth rotating frame
* @param rotationRate central body rotation rate (rad/s)
* @param dsstProp DSST propagator
* @throws IOException
* @throws OrekitException
*/
private void setForceModel(final KeyValueFileParser<ParameterKey> parser, final UnnormalizedSphericalHarmonicsProvider unnormalized, final Frame earthFrame, final double rotationRate, final DSSTPropagator dsstProp) throws IOException, OrekitException {
final double ae = unnormalized.getAe();
final int degree = parser.getInt(ParameterKey.CENTRAL_BODY_DEGREE);
final int order = parser.getInt(ParameterKey.CENTRAL_BODY_ORDER);
if (order > degree) {
throw new IOException("Potential order cannot be higher than potential degree");
}
// Central Body Force Model with un-normalized coefficients
dsstProp.addForceModel(new DSSTZonal(unnormalized, parser.getInt(ParameterKey.MAX_DEGREE_ZONAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_ECCENTRICITY_POWER_ZONAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_FREQUENCY_TRUE_LONGITUDE_ZONAL_SHORT_PERIODS)));
dsstProp.addForceModel(new DSSTTesseral(earthFrame, rotationRate, unnormalized, parser.getInt(ParameterKey.MAX_DEGREE_TESSERAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_ORDER_TESSERAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_ECCENTRICITY_POWER_TESSERAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_FREQUENCY_MEAN_LONGITUDE_TESSERAL_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_DEGREE_TESSERAL_M_DAILIES_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_ORDER_TESSERAL_M_DAILIES_SHORT_PERIODS), parser.getInt(ParameterKey.MAX_ECCENTRICITY_POWER_TESSERAL_M_DAILIES_SHORT_PERIODS)));
// 3rd body (SUN)
if (parser.containsKey(ParameterKey.THIRD_BODY_SUN) && parser.getBoolean(ParameterKey.THIRD_BODY_SUN)) {
dsstProp.addForceModel(new DSSTThirdBody(CelestialBodyFactory.getSun()));
}
// 3rd body (MOON)
if (parser.containsKey(ParameterKey.THIRD_BODY_MOON) && parser.getBoolean(ParameterKey.THIRD_BODY_MOON)) {
dsstProp.addForceModel(new DSSTThirdBody(CelestialBodyFactory.getMoon()));
}
// Drag
if (parser.containsKey(ParameterKey.DRAG) && parser.getBoolean(ParameterKey.DRAG)) {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(ae, Constants.WGS84_EARTH_FLATTENING, earthFrame);
final Atmosphere atm = new HarrisPriester(CelestialBodyFactory.getSun(), earth, 6);
dsstProp.addForceModel(new DSSTAtmosphericDrag(atm, parser.getDouble(ParameterKey.DRAG_CD), parser.getDouble(ParameterKey.DRAG_SF)));
}
// Solar Radiation Pressure
if (parser.containsKey(ParameterKey.SOLAR_RADIATION_PRESSURE) && parser.getBoolean(ParameterKey.SOLAR_RADIATION_PRESSURE)) {
dsstProp.addForceModel(new DSSTSolarRadiationPressure(parser.getDouble(ParameterKey.SOLAR_RADIATION_PRESSURE_CR), parser.getDouble(ParameterKey.SOLAR_RADIATION_PRESSURE_SF), CelestialBodyFactory.getSun(), ae));
}
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class SolarRadiationPressureTest method testRoughOrbitalModifs.
@Test
public void testRoughOrbitalModifs() throws ParseException, OrekitException, FileNotFoundException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 7, 1), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
final double period = orbit.getKeplerianPeriod();
Assert.assertEquals(86164, period, 1);
PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
// creation of the force model
OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.46, 1.0 / 298.25765, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
SolarRadiationPressure SRP = new SolarRadiationPressure(sun, earth.getEquatorialRadius(), new IsotropicRadiationCNES95Convention(500.0, 0.7, 0.7));
// creation of the propagator
double[] absTolerance = { 0.1, 1.0e-9, 1.0e-9, 1.0e-5, 1.0e-5, 1.0e-5, 0.001 };
double[] relTolerance = { 1.0e-4, 1.0e-4, 1.0e-4, 1.0e-6, 1.0e-6, 1.0e-6, 1.0e-7 };
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(900.0, 60000, absTolerance, relTolerance);
integrator.setInitialStepSize(3600);
final NumericalPropagator calc = new NumericalPropagator(integrator);
calc.addForceModel(SRP);
// Step Handler
calc.setMasterMode(FastMath.floor(period), new SolarStepHandler());
AbsoluteDate finalDate = date.shiftedBy(10 * period);
calc.setInitialState(new SpacecraftState(orbit, 1500.0));
calc.propagate(finalDate);
Assert.assertTrue(calc.getCalls() < 7100);
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class TopocentricFrameTest method testIssue145.
@Test
public void testIssue145() throws OrekitException {
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
TopocentricFrame staFrame = new TopocentricFrame(earth, new GeodeticPoint(0.0, 0.0, 0.0), "test");
GeodeticPoint gp = staFrame.computeLimitVisibilityPoint(Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 600000, 0.0, FastMath.toRadians(5.0));
Assert.assertEquals(0.0, gp.getLongitude(), 1.0e-15);
Assert.assertTrue(gp.getLatitude() > 0);
Assert.assertEquals(0.0, staFrame.getNorth().distance(Vector3D.PLUS_K), 1.0e-15);
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class TopocentricFrameTest method testPointAtDistance.
@Test
public void testPointAtDistance() throws OrekitException {
RandomGenerator random = new Well1024a(0xa1e6bd5cd0578779l);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
for (int i = 0; i < 20; ++i) {
// we don't need uniform point on the sphere, just a few different test configurations
double latitude = FastMath.PI * (0.5 - random.nextDouble());
double longitude = 2 * FastMath.PI * random.nextDouble();
TopocentricFrame topo = new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, 0.0), "topo");
Transform transform = earth.getBodyFrame().getTransformTo(topo, date);
for (int j = 0; j < 20; ++j) {
double elevation = FastMath.PI * (0.5 - random.nextDouble());
double azimuth = 2 * FastMath.PI * random.nextDouble();
double range = 500000.0 * (1.0 + random.nextDouble());
Vector3D absolutePoint = earth.transform(topo.pointAtDistance(azimuth, elevation, range));
Vector3D relativePoint = transform.transformPosition(absolutePoint);
double rebuiltElevation = topo.getElevation(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
double rebuiltAzimuth = topo.getAzimuth(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
double rebuiltRange = topo.getRange(relativePoint, topo, AbsoluteDate.J2000_EPOCH);
Assert.assertEquals(elevation, rebuiltElevation, 1.0e-12);
Assert.assertEquals(azimuth, MathUtils.normalizeAngle(rebuiltAzimuth, azimuth), 1.0e-12);
Assert.assertEquals(range, rebuiltRange, 1.0e-12 * range);
}
}
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class TopocentricFrameTest method testEllipticEarth.
@Test
public void testEllipticEarth() throws OrekitException {
// Elliptic earth shape
final OneAxisEllipsoid earthElliptic = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Satellite point
// Caution !!! Sat point target shall be the same whatever earth shape chosen !!
final GeodeticPoint satPointGeo = new GeodeticPoint(FastMath.toRadians(30.), FastMath.toRadians(15.), 800000.);
final Vector3D satPoint = earthElliptic.transform(satPointGeo);
// ****************************
// Test at equatorial position
// ****************************
GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(5.), 0.);
TopocentricFrame topoElliptic = new TopocentricFrame(earthElliptic, point, "elliptic, equatorial lon 5");
TopocentricFrame topoSpheric = new TopocentricFrame(earthSpheric, point, "spheric, equatorial lon 5");
// Compare azimuth/elevation/range of satellite point : shall be strictly identical
// ***************************************************
double aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
double aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(aziElli, aziSphe, Utils.epsilonAngle);
double eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
double eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(eleElli, eleSphe, Utils.epsilonAngle);
double disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
double disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(disElli, disSphe, Utils.epsilonTest);
// Infinite point separated by -20 deg in longitude
// *************************************************
GeodeticPoint infPointGeo = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(-15.), 1000000000.);
Vector3D infPoint = earthElliptic.transform(infPointGeo);
// Azimuth = pi/2
aziElli = topoElliptic.getAzimuth(infPoint, earthElliptic.getBodyFrame(), date);
Assert.assertEquals(3 * FastMath.PI / 2., aziElli, Utils.epsilonAngle);
// Site = pi/2 - longitude difference
eleElli = topoElliptic.getElevation(infPoint, earthElliptic.getBodyFrame(), date);
Assert.assertEquals(FastMath.PI / 2. - FastMath.abs(point.getLongitude() - infPointGeo.getLongitude()), eleElli, 1.e-2);
// Infinite point separated by +20 deg in longitude
// *************************************************
infPointGeo = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(25.), 1000000000.);
infPoint = earthElliptic.transform(infPointGeo);
// Azimuth = pi/2
aziElli = topoElliptic.getAzimuth(infPoint, earthElliptic.getBodyFrame(), date);
Assert.assertEquals(FastMath.PI / 2., aziElli, Utils.epsilonAngle);
// Site = pi/2 - longitude difference
eleElli = topoElliptic.getElevation(infPoint, earthElliptic.getBodyFrame(), date);
Assert.assertEquals(FastMath.PI / 2. - FastMath.abs(point.getLongitude() - infPointGeo.getLongitude()), eleElli, 1.e-2);
// ************************
// Test at polar position
// ************************
point = new GeodeticPoint(FastMath.toRadians(89.999), FastMath.toRadians(0.), 0.);
topoSpheric = new TopocentricFrame(earthSpheric, point, "lon 0 lat 90");
topoElliptic = new TopocentricFrame(earthElliptic, point, "lon 0 lat 90");
// Compare azimuth/elevation/range of satellite point : slight difference due to earth flatness
// ***************************************************
aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(aziElli, aziSphe, 1.e-7);
eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(eleElli, eleSphe, 1.e-2);
disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(disElli, disSphe, 20.e+3);
// *********************
// Test at any position
// *********************
point = new GeodeticPoint(FastMath.toRadians(60), FastMath.toRadians(30.), 0.);
topoSpheric = new TopocentricFrame(earthSpheric, point, "lon 10 lat 45");
topoElliptic = new TopocentricFrame(earthElliptic, point, "lon 10 lat 45");
// Compare azimuth/elevation/range of satellite point : slight difference
// ***************************************************
aziElli = topoElliptic.getAzimuth(satPoint, earthElliptic.getBodyFrame(), date);
aziSphe = topoSpheric.getAzimuth(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(aziElli, aziSphe, 1.e-2);
eleElli = topoElliptic.getElevation(satPoint, earthElliptic.getBodyFrame(), date);
eleSphe = topoSpheric.getElevation(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(eleElli, eleSphe, 1.e-2);
disElli = topoElliptic.getRange(satPoint, earthElliptic.getBodyFrame(), date);
disSphe = topoSpheric.getRange(satPoint, earthSpheric.getBodyFrame(), date);
Assert.assertEquals(disElli, disSphe, 20.e+3);
}
Aggregations