Search in sources :

Example 36 with TopocentricFrame

use of org.orekit.frames.TopocentricFrame in project Orekit by CS-SI.

the class VisibilityCheck method main.

/**
 * Program entry point.
 * @param args program arguments (unused here)
 */
public static void main(String[] args) {
    try {
        // configure Orekit
        File home = new File(System.getProperty("user.home"));
        File orekitData = new File(home, "orekit-data");
        if (!orekitData.exists()) {
            System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
            System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
            System.exit(1);
        }
        DataProvidersManager manager = DataProvidersManager.getInstance();
        manager.addProvider(new DirectoryCrawler(orekitData));
        // Initial state definition : date, orbit
        AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
        // gravitation coefficient
        double mu = 3.986004415e+14;
        // inertial frame for orbit definition
        Frame inertialFrame = FramesFactory.getEME2000();
        Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        PVCoordinates pvCoordinates = new PVCoordinates(position, velocity);
        Orbit initialOrbit = new KeplerianOrbit(pvCoordinates, inertialFrame, initialDate, mu);
        // Propagator : consider a simple Keplerian motion (could be more elaborate)
        Propagator kepler = new KeplerianPropagator(initialOrbit);
        // Earth and frame
        Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame);
        // Station
        final double longitude = FastMath.toRadians(45.);
        final double latitude = FastMath.toRadians(25.);
        final double altitude = 0.;
        final GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
        final TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
        // Event definition
        final double maxcheck = 60.0;
        final double threshold = 0.001;
        final double elevation = FastMath.toRadians(5.0);
        final EventDetector sta1Visi = new ElevationDetector(maxcheck, threshold, sta1Frame).withConstantElevation(elevation).withHandler(new VisibilityHandler());
        // Add event to be detected
        kepler.addEventDetector(sta1Visi);
        // Propagate from the initial date to the first raising or for the fixed duration
        SpacecraftState finalState = kepler.propagate(initialDate.shiftedBy(1500.));
        System.out.println(" Final state : " + finalState.getDate().durationFrom(initialDate));
    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ElevationDetector(org.orekit.propagation.events.ElevationDetector) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) EventDetector(org.orekit.propagation.events.EventDetector) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) DirectoryCrawler(org.orekit.data.DirectoryCrawler) DataProvidersManager(org.orekit.data.DataProvidersManager) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) File(java.io.File)

Example 37 with TopocentricFrame

use of org.orekit.frames.TopocentricFrame in project Orekit by CS-SI.

the class VisibilityCircle method computeCircle.

private static List<GeodeticPoint> computeCircle(double latitude, double longitude, double altitude, String name, double minElevation, double radius, int points) throws OrekitException {
    // define Earth shape, using WGS84 model
    BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, false));
    // define an array of ground stations
    TopocentricFrame station = new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, altitude), name);
    // compute the visibility circle
    List<GeodeticPoint> circle = new ArrayList<GeodeticPoint>();
    for (int i = 0; i < points; ++i) {
        double azimuth = i * (2.0 * FastMath.PI / points);
        circle.add(station.computeLimitVisibilityPoint(radius, azimuth, minElevation));
    }
    // return the computed points
    return circle;
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ArrayList(java.util.ArrayList) TopocentricFrame(org.orekit.frames.TopocentricFrame) GeodeticPoint(org.orekit.bodies.GeodeticPoint) BodyShape(org.orekit.bodies.BodyShape) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Aggregations

TopocentricFrame (org.orekit.frames.TopocentricFrame)37 GeodeticPoint (org.orekit.bodies.GeodeticPoint)35 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)31 Test (org.junit.Test)23 AbsoluteDate (org.orekit.time.AbsoluteDate)23 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)22 Propagator (org.orekit.propagation.Propagator)19 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)19 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)17 SpacecraftState (org.orekit.propagation.SpacecraftState)16 Frame (org.orekit.frames.Frame)15 Orbit (org.orekit.orbits.Orbit)14 PVCoordinates (org.orekit.utils.PVCoordinates)14 BodyShape (org.orekit.bodies.BodyShape)13 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)8 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)8 ElevationDetector (org.orekit.propagation.events.ElevationDetector)8 HashMap (java.util.HashMap)6 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)6