<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://patrius.cnes.fr/index.php?action=history&amp;feed=atom&amp;title=NumericalPropagationWithCustomEvent</id>
	<title>NumericalPropagationWithCustomEvent - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://patrius.cnes.fr/index.php?action=history&amp;feed=atom&amp;title=NumericalPropagationWithCustomEvent"/>
	<link rel="alternate" type="text/html" href="https://patrius.cnes.fr/index.php?title=NumericalPropagationWithCustomEvent&amp;action=history"/>
	<updated>2026-04-06T19:38:48Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://patrius.cnes.fr/index.php?title=NumericalPropagationWithCustomEvent&amp;diff=34&amp;oldid=prev</id>
		<title>Admin : Page créée avec « &lt;syntaxhighlight lang=&quot;java&quot;&gt; public class NumericalPropagationWithCustomEvent {      public static void main(String[] args) throws PatriusException {                  //... »</title>
		<link rel="alternate" type="text/html" href="https://patrius.cnes.fr/index.php?title=NumericalPropagationWithCustomEvent&amp;diff=34&amp;oldid=prev"/>
		<updated>2018-02-13T10:21:55Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « &amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt; public class NumericalPropagationWithCustomEvent {      public static void main(String[] args) throws PatriusException {                  //... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public class NumericalPropagationWithCustomEvent {&lt;br /&gt;
&lt;br /&gt;
    public static void main(String[] args) throws PatriusException {&lt;br /&gt;
        &lt;br /&gt;
        // Patrius Dataset initialization (needed for example to get the UTC time)&lt;br /&gt;
        PatriusDataset.addResourcesFromPatriusDataset() ;&lt;br /&gt;
&lt;br /&gt;
        // Recovery of the UTC time scale using a &amp;quot;factory&amp;quot; (not to duplicate such unique object)&lt;br /&gt;
        final TimeScale TUC = TimeScalesFactory.getUTC();&lt;br /&gt;
        &lt;br /&gt;
        // Date of the orbit given in UTC time scale)&lt;br /&gt;
        final AbsoluteDate date = new AbsoluteDate(&amp;quot;2010-01-01T12:00:00.000&amp;quot;, TUC);&lt;br /&gt;
        &lt;br /&gt;
        // Getting the frame with wich will defined the orbit parameters&lt;br /&gt;
        // As for time scale, we will use also a &amp;quot;factory&amp;quot;.&lt;br /&gt;
        final Frame GCRF = FramesFactory.getGCRF();&lt;br /&gt;
&lt;br /&gt;
        // Initial orbit&lt;br /&gt;
        final double sma = 7200.e+3;&lt;br /&gt;
        final double exc = 0.02;&lt;br /&gt;
        final double per = sma*(1.-exc);&lt;br /&gt;
        final double apo = sma*(1.+exc);&lt;br /&gt;
        final double inc = FastMath.toRadians(98.);&lt;br /&gt;
        final double pa = FastMath.toRadians(0.);&lt;br /&gt;
        final double raan = FastMath.toRadians(0.);&lt;br /&gt;
        final double anm = FastMath.toRadians(180.);&lt;br /&gt;
        final double MU = Constants.WGS84_EARTH_MU;&lt;br /&gt;
        &lt;br /&gt;
        final ApsisRadiusParameters par = new ApsisRadiusParameters(per, apo, inc, pa, raan, anm, PositionAngle.MEAN, MU);&lt;br /&gt;
        final Orbit iniOrbit = new ApsisOrbit(par, GCRF, date);&lt;br /&gt;
        &lt;br /&gt;
        // We create a spacecratftstate&lt;br /&gt;
        final SpacecraftState iniState = new SpacecraftState(iniOrbit);&lt;br /&gt;
&lt;br /&gt;
        // Initialization of the Runge Kutta integrator with a 2 s step&lt;br /&gt;
        final double pasRk = 2.;&lt;br /&gt;
        final FirstOrderIntegrator integrator = new ClassicalRungeKuttaIntegrator(pasRk);&lt;br /&gt;
        &lt;br /&gt;
        // Initialization of the propagator&lt;br /&gt;
        final NumericalPropagator propagator = new NumericalPropagator(integrator);&lt;br /&gt;
        propagator.resetInitialState(iniState);&lt;br /&gt;
        &lt;br /&gt;
        // Forcing integration using cartesian equations&lt;br /&gt;
        propagator.setOrbitType(OrbitType.CARTESIAN);&lt;br /&gt;
        &lt;br /&gt;
//SPECIFIC&lt;br /&gt;
        // Definition of the custom event&lt;br /&gt;
        EventDetector event = new EventDetector() {&lt;br /&gt;
            &lt;br /&gt;
            private static final long serialVersionUID = 1L;&lt;br /&gt;
            public double g(SpacecraftState s) throws PatriusException {&lt;br /&gt;
                // We want to raise the event when Lv = 45 deg&lt;br /&gt;
                final double delta = s.getLv() - FastMath.toRadians(45.);&lt;br /&gt;
                return delta;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            public Action eventOccurred(SpacecraftState s, boolean increasing,&lt;br /&gt;
                    boolean forward) throws PatriusException {&lt;br /&gt;
                System.out.println(&amp;quot;Event occured at date : &amp;quot;+s.getDate().toString(TUC)+&amp;quot; (LM = &amp;quot;+FastMath.toDegrees(s.getLv())+&amp;quot;)&amp;quot;);&lt;br /&gt;
                return Action.CONTINUE;&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            public boolean shouldBeRemoved() {&lt;br /&gt;
                return false;&lt;br /&gt;
            }&lt;br /&gt;
            public SpacecraftState resetState(SpacecraftState oldState)&lt;br /&gt;
                    throws PatriusException {&lt;br /&gt;
                return null;&lt;br /&gt;
            }&lt;br /&gt;
            public void init(SpacecraftState s0, AbsoluteDate t) {&lt;br /&gt;
            }&lt;br /&gt;
            public double getThreshold() {&lt;br /&gt;
                return AbstractDetector.DEFAULT_THRESHOLD;&lt;br /&gt;
            }&lt;br /&gt;
            public int getSlopeSelection() {&lt;br /&gt;
                return 0;&lt;br /&gt;
            }&lt;br /&gt;
            public int getMaxIterationCount() {&lt;br /&gt;
                return 20;&lt;br /&gt;
            }&lt;br /&gt;
            public double getMaxCheckInterval() {&lt;br /&gt;
                return AbstractDetector.DEFAULT_MAXCHECK;&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
        };&lt;br /&gt;
        &lt;br /&gt;
        // Adding the event to the propagator&lt;br /&gt;
        propagator.addEventDetector(event);&lt;br /&gt;
//SPECIFIC&lt;br /&gt;
&lt;br /&gt;
        // Propagating on several orbits&lt;br /&gt;
        final double dt = 5.*iniOrbit.getKeplerianPeriod();&lt;br /&gt;
        final AbsoluteDate finalDate = date.shiftedBy(dt);&lt;br /&gt;
        propagator.propagate(finalDate);&lt;br /&gt;
        &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>