use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVAwayFromEarth.
@Test
public void testFOVAwayFromEarth() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.MINUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
Assert.assertEquals(0, footprint.size());
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class GeographicZoneDetectorTest method testSerialization.
@Test
public void testSerialization() throws IOException, ClassNotFoundException, OrekitException {
final double r = Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
final BodyShape earth = new OneAxisEllipsoid(r, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
GeographicZoneDetector d = new GeographicZoneDetector(20.0, 1.e-3, earth, buildFrance(), FastMath.toRadians(0.5)).withMargin(FastMath.toRadians(0.75)).withHandler(new ContinueOnEvent<GeographicZoneDetector>());
Assert.assertEquals(r, ((OneAxisEllipsoid) d.getBody()).getEquatorialRadius(), 1.0e-12);
Assert.assertEquals(0.75, FastMath.toDegrees(d.getMargin()), 1.0e-12);
Assert.assertEquals(5.6807e11, d.getZone().getSize() * r * r, 1.0e9);
Assert.assertEquals(4.0289e6, d.getZone().getBoundarySize() * r, 1.0e3);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(d);
Assert.assertTrue(bos.size() > 2100);
Assert.assertTrue(bos.size() < 2200);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
GeographicZoneDetector deserialized = (GeographicZoneDetector) ois.readObject();
Assert.assertEquals(d.getZone().getSize(), deserialized.getZone().getSize(), 1.0e-3);
Assert.assertEquals(d.getZone().getBoundarySize(), deserialized.getZone().getBoundarySize(), 1.0e-3);
Assert.assertEquals(d.getZone().getTolerance(), deserialized.getZone().getTolerance(), 1.0e-15);
Assert.assertEquals(d.getMaxCheckInterval(), deserialized.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(d.getThreshold(), deserialized.getThreshold(), 1.0e-15);
Assert.assertEquals(d.getMaxIterationCount(), deserialized.getMaxIterationCount());
Assert.assertTrue(new RegionFactory<Sphere2D>().difference(d.getZone(), deserialized.getZone()).isEmpty());
}
use of org.orekit.bodies.OneAxisEllipsoid 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));
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class CircularFieldOfViewDetectorTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
// Computation date
// Satellite position as circular parameters
mu = 3.9860047e14;
initDate = new AbsoluteDate(new DateComponents(1969, 8, 28), TimeComponents.H00, TimeScalesFactory.getUTC());
Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6);
Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
initialOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
// WGS84 Earth model
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Create earth center pointing attitude provider
earthCenterAttitudeLaw = new BodyCenterPointing(initialOrbit.getFrame(), earth);
} catch (OrekitException oe) {
Assert.fail(oe.getMessage());
}
}
use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.
the class BackAndForthDetectorTest method testBackAndForth.
@Test
public void testBackAndForth() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final AbsoluteDate date0 = new AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
final AbsoluteDate date1 = new AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
final AbsoluteDate date2 = new AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
// Orbit
final double a = 7274000.;
final double e = 0.00127;
final double i = FastMath.toRadians(90.);
final double w = FastMath.toRadians(0.);
final double raan = FastMath.toRadians(12.5);
final double lM = FastMath.toRadians(60.);
Orbit iniOrb = new KeplerianOrbit(a, e, i, w, raan, lM, PositionAngle.MEAN, FramesFactory.getEME2000(), date0, Constants.WGS84_EARTH_MU);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(iniOrb);
// Station
final GeodeticPoint stationPosition = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(100.), 110.);
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final TopocentricFrame stationFrame = new TopocentricFrame(earth, stationPosition, "");
// Detector
final Visibility visi = new Visibility();
propagator.addEventDetector(new ElevationDetector(stationFrame).withConstantElevation(FastMath.toRadians(10.)).withHandler(visi));
// Forward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date2);
// Backward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date0);
Assert.assertEquals(4, visi.getVisiNb());
}
Aggregations