use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.
the class ElevationDetectorTest method testEventForMask.
@Test
public void testEventForMask() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
Propagator propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
// Earth and frame
// equatorial radius in meter
double ae = 6378137.0;
// flattening
double f = 1.0 / 298.257223563;
// terrestrial frame at an arbitrary date
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(48.833), FastMath.toRadians(2.333), 0.0);
TopocentricFrame topo = new TopocentricFrame(earth, point, "Gstation");
double[][] maskValues = { { FastMath.toRadians(0), FastMath.toRadians(5) }, { FastMath.toRadians(30), FastMath.toRadians(4) }, { FastMath.toRadians(60), FastMath.toRadians(3) }, { FastMath.toRadians(90), FastMath.toRadians(2) }, { FastMath.toRadians(120), FastMath.toRadians(3) }, { FastMath.toRadians(150), FastMath.toRadians(4) }, { FastMath.toRadians(180), FastMath.toRadians(5) }, { FastMath.toRadians(210), FastMath.toRadians(6) }, { FastMath.toRadians(240), FastMath.toRadians(5) }, { FastMath.toRadians(270), FastMath.toRadians(4) }, { FastMath.toRadians(300), FastMath.toRadians(3) }, { FastMath.toRadians(330), FastMath.toRadians(4) } };
ElevationMask mask = new ElevationMask(maskValues);
ElevationDetector detector = new ElevationDetector(topo).withElevationMask(mask).withHandler(new StopOnIncreasing<ElevationDetector>());
Assert.assertSame(mask, detector.getElevationMask());
AbsoluteDate startDate = new AbsoluteDate(2003, 9, 15, 20, 0, 0, utc);
propagator.resetInitialState(propagator.propagate(startDate));
propagator.addEventDetector(detector);
final SpacecraftState fs = propagator.propagate(startDate.shiftedBy(Constants.JULIAN_DAY));
double elevation = topo.getElevation(fs.getPVCoordinates().getPosition(), fs.getFrame(), fs.getDate());
Assert.assertEquals(0.065, elevation, 2.0e-5);
}
use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.
the class EventDetectorTest method testWrappedException.
@Test
public void testWrappedException() throws OrekitException {
final Throwable dummyCause = new RuntimeException();
try {
// initial conditions
Frame eme2000 = FramesFactory.getEME2000();
TimeScale utc = TimeScalesFactory.getUTC();
final AbsoluteDate initialDate = new AbsoluteDate(2011, 5, 11, utc);
final AbsoluteDate exceptionDate = initialDate.shiftedBy(3600.0);
KeplerianPropagator k = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008462.4706055815, -3155502.5373837613, -5044275.9880020910), new Vector3D(-5012.9298276860990, 1920.3567095973078, -5172.7403501801580)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
k.addEventDetector(new DateDetector(initialDate.shiftedBy(Constants.JULIAN_DAY)) {
private static final long serialVersionUID = 1L;
@Override
public double g(final SpacecraftState s) throws OrekitException {
final double dt = s.getDate().durationFrom(exceptionDate);
if (FastMath.abs(dt) < 1.0) {
throw new OrekitException(dummyCause, LocalizedCoreFormats.SIMPLE_MESSAGE, "dummy");
}
return dt;
}
});
k.propagate(initialDate.shiftedBy(Constants.JULIAN_YEAR));
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertSame(dummyCause, oe.getCause());
}
}
use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.
the class EventShifterTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
mu = 3.9860047e14;
double ae = 6.378137e6;
double c20 = -1.08263e-3;
double c30 = 2.54e-6;
double c40 = 1.62e-6;
double c50 = 2.3e-7;
double c60 = -5.5e-7;
final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getGCRF(), iniDate, mu);
propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
log = new ArrayList<EventEntry>();
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.
the class AlignmentDetectorTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
double mu = 3.9860047e14;
final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), iniDate, mu);
initialState = new SpacecraftState(orbit);
double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
integrator.setInitialStepSize(60);
propagator = new NumericalPropagator(integrator);
propagator.setInitialState(initialState);
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
use of org.orekit.orbits.EquinoctialOrbit in project Orekit by CS-SI.
the class JacobianPropagatorConverterTest method setUp.
@Before
public void setUp() throws OrekitException, IOException, ParseException {
Utils.setDataRoot("regular-data:potential/shm-format");
gravity = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(2, 0));
mu = gravity.getParameterDriver(NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT).getValue();
dP = 1.0;
// use a orbit that comes close to Earth so the drag coefficient has an effect
final Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6).normalize().scalarMultiply(Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 300e3);
final Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
final AbsoluteDate initDate = new AbsoluteDate(2010, 10, 10, 10, 10, 10.0, TimeScalesFactory.getUTC());
orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
earth.setAngularThreshold(1.e-7);
atmosphere = new SimpleExponentialAtmosphere(earth, 0.0004, 42000.0, 7500.0);
final double dragCoef = 2.0;
crossSection = 25.0;
drag = new DragForce(atmosphere, new IsotropicDrag(crossSection, dragCoef));
}
Aggregations