NumericalPropagationWithPotential 4.1
De Wiki
Révision de 18 décembre 2018 à 10:30 par Admin (discussion | contributions) (Page créée avec « <syntaxhighlight lang="java"> public class NumericalPropagationWithPotential { public static void main(String[] args) throws PatriusException, IOException, ParseExcep... »)
public class NumericalPropagationWithPotential { public static void main(String[] args) throws PatriusException, IOException, ParseException { // 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 per = sma*(1.-exc); final double apo = sma*(1.+exc); 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 ApsisRadiusParameters par = new ApsisRadiusParameters(per, apo, inc, pa, raan, anm, PositionAngle.MEAN, MU); final Orbit iniOrbit = new ApsisOrbit(par, GCRF, date); // We create a spacecratftstate final SpacecraftState iniState = new SpacecraftState(iniOrbit); // Initialization of the Runge Kutta integrator with a 2 s step final double pasRk = 2.; final FirstOrderIntegrator integrator = new ClassicalRungeKuttaIntegrator(pasRk); // Initialization of the propagator final NumericalPropagator propagator = new NumericalPropagator(integrator); propagator.resetInitialState(iniState); // Forcing integration using cartesian equations propagator.setOrbitType(OrbitType.CARTESIAN); //SPECIFIC // Adding gravity field (8x8) final ForceModel potentiel = EarthGravitationalModelFactory.getDroziner(GravityFieldNames.GRGS, "grim4s4_gr", 8, 8, true); propagator.addForceModel(potentiel); //SPECIFIC // Propagating 1000s final double dt = 1000.; final AbsoluteDate finalDate = date.shiftedBy(dt); final SpacecraftState finalState = propagator.propagate(finalDate); final Orbit finalOrbit = finalState.getOrbit(); // Printing new date and semi major axis System.out.println(); System.out.println("Initial semi major axis = "+iniOrbit.getA()/1000.+" km"); System.out.println("New date = "+finalOrbit.getDate().toString(TUC)+" deg"); System.out.println("Final semi major axis = "+finalOrbit.getA()/1000.+" km"); } }