Class MinorBodyPropagator


  • public class MinorBodyPropagator
    extends java.lang.Object
    To propagate the orbits of the minor objects to certain final epoch.
    Author:
    talonso
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getFile​(java.lang.String folder, double jd)
      Returns the path to a given binary file
      static java.util.ArrayList<java.lang.String> getFilenamesInLocalFolder​(java.lang.String directoryName)
      Returns the list of files in the provided local folder
      static int getNumberOfPerturbersUsed​(java.io.File f)
      Returns the number of perturbing asteroids used in a given preintegrated file, provided that the file is complete, including the calculations for comets
      static OrbitalElement getOrbitalElementsFromPositionAndVelocity​(double[] pos, double[] v, double jd, double mass, java.lang.String name, boolean checkTolerance)
      Obtain a set of orbital elements knowing the position and velocity vectors in certain instant, according to the classical theory of the two body motion.
      static OrbitalElement getOrbitalElementsFromPositionAndVelocity​(double[] pos, double[] v, double jd, double mass, java.lang.String name, double checkTolerance)
      Obtain a set of orbital elements knowing the position and velocity vectors in certain instant, according to the classical theory of the two body motion.
      static void main​(java.lang.String[] args)
      Main program.
      static void preIntegrate​(java.util.ArrayList<OrbitalElement> aster, java.util.ArrayList<OrbitalElement> comet, java.lang.Double forceStartJD)
      Preintegration program
      static java.util.ArrayList<OrbitalElement> readElements​(java.io.File f, boolean jpl, boolean checkList)
      Reads the data contained in a given file and returns the list of orbital elements from the position and velocity vector on it, for all minor bodies
      static java.util.ArrayList<OrbitalElement> readElements​(java.io.File f, boolean jpl, boolean checkList, int limitAster, int limitComet)
      Reads the data contained in a given file and returns the list of orbital elements from the position and velocity vector on it, for all minor bodies
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.InterruptedException,
                                java.io.IOException,
                                spice.basic.SpiceErrorException
        Main program.
        Parameters:
        args - Not used.
        Throws:
        java.lang.InterruptedException - Threading errors
        java.io.IOException - File system errors
        spice.basic.SpiceErrorException - Ephemeris/kernel errors
      • preIntegrate

        public static void preIntegrate​(java.util.ArrayList<OrbitalElement> aster,
                                        java.util.ArrayList<OrbitalElement> comet,
                                        java.lang.Double forceStartJD)
                                 throws java.lang.InterruptedException,
                                        java.io.IOException,
                                        spice.basic.SpiceErrorException
        Preintegration program
        Parameters:
        aster - Asteroids list, or null
        comet - Comets list, or null
        forceStartJD - Julian day to be used for the first reference date of the preintegrated files, or null to take it from the elements
        Throws:
        java.lang.InterruptedException - Threading errors
        java.io.IOException - File system errors
        spice.basic.SpiceErrorException - Ephemeris/kernel errors
      • getFilenamesInLocalFolder

        public static java.util.ArrayList<java.lang.String> getFilenamesInLocalFolder​(java.lang.String directoryName)
                                                                               throws spice.basic.SpiceErrorException,
                                                                                      java.io.IOException
        Returns the list of files in the provided local folder
        Parameters:
        directoryName - Name of folder in the local system
        Returns:
        List of files
        Throws:
        spice.basic.SpiceErrorException - Whatever problem reading the missions
        java.io.IOException - Whatever problem reading the properties file (when not read before)
      • getFile

        public static java.lang.String getFile​(java.lang.String folder,
                                               double jd)
                                        throws spice.basic.SpiceErrorException,
                                               java.io.IOException
        Returns the path to a given binary file
        Parameters:
        folder - Folder where the files are located, respect the local folder
        jd - Julian day for the file name, or <= 0 for the index file
        Returns:
        Path to the preintegration file for the date and folder provided
        Throws:
        spice.basic.SpiceErrorException - Whatever problem reading the missions
        java.io.IOException - Whatever problem reading the properties file (when not read before)
      • getNumberOfPerturbersUsed

        public static int getNumberOfPerturbersUsed​(java.io.File f)
                                             throws java.io.IOException
        Returns the number of perturbing asteroids used in a given preintegrated file, provided that the file is complete, including the calculations for comets
        Parameters:
        f - The file
        Returns:
        The number of perturbing asteroids
        Throws:
        java.io.IOException - If the file does not exists, is not complete, or an IO error happened
      • readElements

        public static java.util.ArrayList<OrbitalElement> readElements​(java.io.File f,
                                                                       boolean jpl,
                                                                       boolean checkList)
                                                                throws spice.basic.SpiceErrorException,
                                                                       java.io.IOException
        Reads the data contained in a given file and returns the list of orbital elements from the position and velocity vector on it, for all minor bodies
        Parameters:
        f - File to read
        jpl - If the file belongs to JPL elements, or Lowell ones
        checkList - True to check the objects in the output list, comparing with NBodyIntegrator.getOrbitalElements()
        Returns:
        List of orbital elements
        Throws:
        spice.basic.SpiceErrorException - Ephemeris errors
        java.io.IOException - Whatever problem reading the elements file
      • readElements

        public static java.util.ArrayList<OrbitalElement> readElements​(java.io.File f,
                                                                       boolean jpl,
                                                                       boolean checkList,
                                                                       int limitAster,
                                                                       int limitComet)
                                                                throws spice.basic.SpiceErrorException,
                                                                       java.io.IOException
        Reads the data contained in a given file and returns the list of orbital elements from the position and velocity vector on it, for all minor bodies
        Parameters:
        f - File to read
        jpl - If the file belongs to JPL elements, or Lowell ones
        checkList - True to check the objects in the output list, comparing with NBodyIntegrator.getOrbitalElements()
        limitAster - Maximum number of asteroids to read, or -1 to read them all
        limitComet - Maximum number of comets to read, or -1 to read them all
        Returns:
        List of orbital elements
        Throws:
        spice.basic.SpiceErrorException - Ephemeris errors
        java.io.IOException - Whatever problem reading the elements file
      • getOrbitalElementsFromPositionAndVelocity

        public static OrbitalElement getOrbitalElementsFromPositionAndVelocity​(double[] pos,
                                                                               double[] v,
                                                                               double jd,
                                                                               double mass,
                                                                               java.lang.String name,
                                                                               boolean checkTolerance)
                                                                        throws java.lang.IllegalArgumentException,
                                                                               java.io.IOException,
                                                                               spice.basic.SpiceErrorException
        Obtain a set of orbital elements knowing the position and velocity vectors in certain instant, according to the classical theory of the two body motion.
        For reference see Practical Ephemeris Calculations, by Oliver Montenbruck, chapter 3
        Parameters:
        pos - Geometric heliocentric position vector in ecliptic coordinates, in AU. Velocities can be included here in case v is set to null
        v - Heliocentric velocity vector in ecliptic coordinates, in AU / day. Velocities can be included in pos when v is null
        jd - Time of vectors as Julian day
        mass - Mass of the orbiting body in Msun. Can be set to zero if it is very low or unknown
        name - Body name
        checkTolerance - True will check the output and set converge flag to false in case the elements will not recover accurately the input vector, using as tolerance 1E-10 AU
        Returns:
        A set of orbital elements describing the shape and orientation of the orbit, and ready for subsequent ephemeris calculations (all data except magnitude, mag slope, name, and applicable times). Mean equinox and ecliptic of the input vector (assumed J2000)
        Throws:
        java.lang.IllegalArgumentException - If the orbit is a straight line through the sun
        java.io.IOException - File system errors
        spice.basic.SpiceErrorException - Ephemeris/kernel errors
      • getOrbitalElementsFromPositionAndVelocity

        public static OrbitalElement getOrbitalElementsFromPositionAndVelocity​(double[] pos,
                                                                               double[] v,
                                                                               double jd,
                                                                               double mass,
                                                                               java.lang.String name,
                                                                               double checkTolerance)
                                                                        throws java.lang.IllegalArgumentException,
                                                                               java.io.IOException,
                                                                               spice.basic.SpiceErrorException
        Obtain a set of orbital elements knowing the position and velocity vectors in certain instant, according to the classical theory of the two body motion.
        For reference see Practical Ephemeris Calculations, by Oliver Montenbruck, chapter 3.
        Parameters:
        pos - Geometric heliocentric position vector in ecliptic coordinates, in AU. Velocities can be included here in case v is set to null.
        v - Heliocentric velocity vector in ecliptic coordinates, in AU / day. Velocities can be included in pos when v is null
        jd - Time of vectors as Julian day.
        mass - Mass of the orbiting body in Msun. Can be set to zero if it is very low or unknown.
        name - Body name
        checkTolerance - Tolerance value to consider the elements computed as wrong. Set to <=0 to skip this check.
        Returns:
        A set of orbital elements describing the shape and orientation of the orbit, and ready for subsequent ephemeris calculations (all data except magnitude, mag slope, name, and applicable times). Mean equinox and ecliptic of the input vector (assumed J2000).
        Throws:
        java.lang.IllegalArgumentException - If the orbit is a straight line through the sun.
        spice.basic.SpiceErrorException - If the JPL constant GMS cannot be read
        java.io.IOException - File system errors