SolarPointedAttitudeLaw 4.4 : Différence entre versions

De Wiki
Aller à : navigation, rechercher
(Page créée avec « public class SolarPointedAttitudeLaw { public static void main(String[] args) throws PatriusException, IOException, URISyntaxException { // Patrius D... »)
 
 
Ligne 1 : Ligne 1 :
 +
<syntaxhighlight lang="java">
 
public class SolarPointedAttitudeLaw {
 
public class SolarPointedAttitudeLaw {
  
Ligne 66 : Ligne 67 :
  
 
}
 
}
 +
</syntaxhighlight>

Version actuelle en date du 3 octobre 2019 à 12:00

public class SolarPointedAttitudeLaw {
 
    public static void main(String[] args) throws PatriusException, IOException, URISyntaxException {
 
        // Patrius Dataset initialization (needed for example to get the UTC time
        PatriusDataset.addResourcesFromPatriusDataset() ;
 
        // Recovery of the UTC time scale using a "factory" (not to duplicate such unique object)
        final TimeScale TUC = TimeScalesFactory.getUTC();
 
        // Date of the orbit given in UTC time scale)
        final AbsoluteDate date = new AbsoluteDate("2010-01-01T12:00:00.000", TUC);
 
        // Getting the frame with wich will defined the orbit parameters
        // As for time scale, we will use also a "factory".
        final Frame GCRF = FramesFactory.getGCRF();
 
        // Initial orbit
        final double sma = 7200.e+3;
        final double exc = 0.01;
        final double inc = FastMath.toRadians(98.);
        final double pa = FastMath.toRadians(0.);
        final double raan = FastMath.toRadians(0.);
        final double anm = FastMath.toRadians(0.);
        final double MU = Constants.WGS84_EARTH_MU;
 
        final KeplerianParameters par = new KeplerianParameters(sma, exc, inc, pa, raan, anm, PositionAngle.MEAN, MU);
        final Orbit iniOrbit = new KeplerianOrbit(par, GCRF, date);
 
        // Using the Meeus model for the Sun.
        final CelestialBody sun = new MeeusSun();
 
        // Building an attitude law
        final Vector3D firstAxis = new Vector3D(1., 0., 0.);
        final Vector3D secondAxis = new Vector3D(0., 1., 0.);
        final AttitudeLaw attitudeLaw = new SunPointing(sun, firstAxis, secondAxis, sun);
        final Attitude att = attitudeLaw.getAttitude(iniOrbit);
 
        // Printing attitude
        final double psi  = att.getRotation().getAngles(RotationOrder.ZYX)[0];
        final double teta = att.getRotation().getAngles(RotationOrder.ZYX)[1];
 
        System.out.println("Psi  / GCRF  = "+FastMath.toDegrees(psi)+" deg");
        System.out.println("Teta / GCRF = "+FastMath.toDegrees(teta)+" deg");
 
        // Coordinates of the Sun vs GCRF at the same date
        PVCoordinates pv = sun.getPVCoordinates(date, GCRF);
        final Vector3D sunPos = pv.getPosition();
 
        // Direction of the Sun from the cdg of the satellite
        final Vector3D satPos = iniOrbit.getPVCoordinates(GCRF).getPosition();
        final Rotation sunDir = new Rotation(Vector3D.PLUS_I, sunPos.subtract(satPos));
 
        final double psiSun  = sunDir.getAngles(RotationOrder.ZYX)[0];
        final double tetaSun = sunDir.getAngles(RotationOrder.ZYX)[1];
 
        System.out.println();
        System.out.println("Psi  / GCRF  = "+FastMath.toDegrees(psiSun)+" deg");
        System.out.println("Teta / GCRF = "+FastMath.toDegrees(tetaSun)+" deg");
 
        System.out.println();
        System.out.println("Delta Psi  = "+FastMath.toDegrees(psiSun-psi)+" deg");
        System.out.println("Delta Teta = "+FastMath.toDegrees(tetaSun-teta)+" deg");
 
    }
 
}