Search in sources :

Example 21 with BodyShape

use of org.orekit.bodies.BodyShape in project Orekit by CS-SI.

the class Frames1 method main.

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
        TimeScale utc = TimeScalesFactory.getUTC();
        AbsoluteDate initialDate = new AbsoluteDate(2008, 10, 01, 0, 0, 00.000, utc);
        // gravitation coefficient
        double mu = 3.986004415e+14;
        // inertial frame for orbit definition
        Frame inertialFrame = FramesFactory.getEME2000();
        Vector3D posisat = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        Vector3D velosat = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        PVCoordinates pvsat = new PVCoordinates(posisat, velosat);
        Orbit initialOrbit = new CartesianOrbit(pvsat, inertialFrame, initialDate, mu);
        // Propagator : consider a simple Keplerian motion
        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 station = new GeodeticPoint(latitude, longitude, altitude);
        final TopocentricFrame staF = new TopocentricFrame(earth, station, "station");
        System.out.println("          time           doppler (m/s)");
        // Stop date
        final AbsoluteDate finalDate = new AbsoluteDate(initialDate, 6000, utc);
        // Loop
        AbsoluteDate extrapDate = initialDate;
        while (extrapDate.compareTo(finalDate) <= 0) {
            // We can simply get the position and velocity of spacecraft in station frame at any time
            PVCoordinates pvInert = kepler.propagate(extrapDate).getPVCoordinates();
            PVCoordinates pvStation = inertialFrame.getTransformTo(staF, extrapDate).transformPVCoordinates(pvInert);
            // And then calculate the doppler signal
            double doppler = Vector3D.dotProduct(pvStation.getPosition(), pvStation.getVelocity()) / pvStation.getPosition().getNorm();
            System.out.format(Locale.US, "%s   %9.3f%n", extrapDate, doppler);
            extrapDate = extrapDate.shiftedBy(600);
        }
    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) 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) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) File(java.io.File)

Example 22 with BodyShape

use of org.orekit.bodies.BodyShape in project Orekit by CS-SI.

the class Frames3 method main.

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
        // ****
        AbsoluteDate initialDate = new AbsoluteDate(2003, 4, 7, 10, 55, 21.575, TimeScalesFactory.getUTC());
        // Orbit
        // *****
        // The Sun is in the orbital plane for raan ~ 202
        // gravitation coefficient
        double mu = 3.986004415e+14;
        // inertial frame
        Frame eme2000 = FramesFactory.getEME2000();
        Orbit orbit = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.), FastMath.toRadians(220.), FastMath.toRadians(5.300), PositionAngle.MEAN, eme2000, initialDate, mu);
        // Attitude laws
        // *************
        // Earth
        Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame);
        // Target pointing attitude provider over satellite nadir at date, without yaw compensation
        NadirPointing nadirLaw = new NadirPointing(eme2000, earth);
        // Target pointing attitude provider with yaw compensation
        final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
        YawSteering yawSteeringLaw = new YawSteering(eme2000, nadirLaw, sun, Vector3D.MINUS_I);
        // Propagator : Eckstein-Hechler analytic propagator
        Propagator propagator = new EcksteinHechlerPropagator(orbit, yawSteeringLaw, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
        // Let's write the results in a file in order to draw some plots.
        propagator.setMasterMode(10, new OrekitFixedStepHandler() {

            PrintStream out = null;

            public void init(SpacecraftState s0, AbsoluteDate t, double step) throws OrekitException {
                try {
                    File file = new File(System.getProperty("user.home"), "XYZ.dat");
                    System.out.println("Results written to file: " + file.getAbsolutePath());
                    out = new PrintStream(file, "UTF-8");
                    out.println("#time X Y Z Wx Wy Wz");
                } catch (IOException ioe) {
                    throw new OrekitException(ioe, LocalizedCoreFormats.SIMPLE_MESSAGE, ioe.getLocalizedMessage());
                }
            }

            public void handleStep(SpacecraftState currentState, boolean isLast) throws OrekitException {
                // get the transform from orbit/attitude reference frame to spacecraft frame
                Transform inertToSpacecraft = currentState.toTransform();
                // get the position of the Sun in orbit/attitude reference frame
                Vector3D sunInert = sun.getPVCoordinates(currentState.getDate(), currentState.getFrame()).getPosition();
                // convert Sun position to spacecraft frame
                Vector3D sunSat = inertToSpacecraft.transformPosition(sunInert);
                // and the spacecraft rotational rate also
                Vector3D spin = inertToSpacecraft.getRotationRate();
                // Lets calculate the reduced coordinates
                double sunX = sunSat.getX() / sunSat.getNorm();
                double sunY = sunSat.getY() / sunSat.getNorm();
                double sunZ = sunSat.getZ() / sunSat.getNorm();
                out.format(Locale.US, "%s %12.3f %12.3f %12.3f %12.7f %12.7f %12.7f%n", currentState.getDate(), sunX, sunY, sunZ, spin.getX(), spin.getY(), spin.getZ());
                if (isLast) {
                    out.close();
                }
            }
        });
        System.out.println("Running...");
        propagator.propagate(initialDate.shiftedBy(6000));
    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}
Also used : NadirPointing(org.orekit.attitudes.NadirPointing) PrintStream(java.io.PrintStream) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) IOException(java.io.IOException) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) DirectoryCrawler(org.orekit.data.DirectoryCrawler) YawSteering(org.orekit.attitudes.YawSteering) DataProvidersManager(org.orekit.data.DataProvidersManager) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) OrekitException(org.orekit.errors.OrekitException) Transform(org.orekit.frames.Transform) File(java.io.File) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler)

Example 23 with BodyShape

use of org.orekit.bodies.BodyShape 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 24 with BodyShape

use of org.orekit.bodies.BodyShape 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

BodyShape (org.orekit.bodies.BodyShape)24 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)20 GeodeticPoint (org.orekit.bodies.GeodeticPoint)17 Test (org.junit.Test)15 AbsoluteDate (org.orekit.time.AbsoluteDate)15 TopocentricFrame (org.orekit.frames.TopocentricFrame)13 Propagator (org.orekit.propagation.Propagator)13 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)12 Frame (org.orekit.frames.Frame)12 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)12 Orbit (org.orekit.orbits.Orbit)12 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)11 SpacecraftState (org.orekit.propagation.SpacecraftState)8 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)8 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)7 TimeScale (org.orekit.time.TimeScale)7 PVCoordinates (org.orekit.utils.PVCoordinates)7 Transform (org.orekit.frames.Transform)5 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)4 File (java.io.File)3