LoadingSunEphemeris 4.4

De Wiki
Révision de 3 octobre 2019 à 12:02 par Admin (discussion | contributions)

(diff) ← Version précédente | Voir la version courante (diff) | Version suivante → (diff)
Aller à : navigation, rechercher
public class LoadingSunEphemeris {
 
    public static void main(String[] args) throws PatriusException, IOException, URISyntaxException {
 
        // Patrius Dataset initialization
        PatriusDataset.addResourcesFromPatriusDataset() ;
 
        //String[] fileNames = { "unxp2000.405", "unxp1950.405", "unxp2700.406" };
        String[] fileNames = { "unxp.*.405", "unxp.*.406" };
 
        // data for Sun coordinates output
        final TimeScale tuc = TimeScalesFactory.getUTC();       
        final AbsoluteDate date = new AbsoluteDate("2010-01-01T12:00:00.000", tuc);
        final Frame icrf = FramesFactory.getICRF();
 
        for (int i = 0; i < fileNames.length; i++) {
 
            final JPLEphemeridesLoader loader = new JPLEphemeridesLoader(fileNames[i], EphemerisType.SUN);
 
            CelestialBodyFactory.clearCelestialBodyLoaders();
            CelestialBodyFactory.addCelestialBodyLoader(CelestialBodyFactory.SUN, loader);
 
            // Using the loading theory
            final CelestialBody sun = loader.loadCelestialBody(CelestialBodyFactory.SUN);
 
            // Coordinates of the Sun at a given date and reference frame
            PVCoordinates pv = sun.getPVCoordinates(date, icrf);
 
            System.out.println("");
            System.out.println(pv.getPosition().getX());
            System.out.println(pv.getPosition().getY());
            System.out.println(pv.getPosition().getZ());
        }
 
    }
 
}