1   /* Copyright 2002-2015 CS Systèmes d'Information
2    * Licensed to CS Systèmes d'Information (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.propagation.semianalytical.dsst.forces;
18  
19  import org.orekit.attitudes.AttitudeProvider;
20  import org.orekit.errors.OrekitException;
21  import org.orekit.propagation.SpacecraftState;
22  import org.orekit.propagation.events.EventDetector;
23  import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;
24  import org.orekit.time.AbsoluteDate;
25  
26  /** This interface represents a force modifying spacecraft motion for a {@link
27   *  org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSSTPropagator}.
28   *  <p>
29   *  Objects implementing this interface are intended to be added to a {@link
30   *  org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSST propagator}
31   *  before the propagation is started.
32   *  </p>
33   *  <p>
34   *  The propagator will call at the very beginning of a propagation the {@link
35   *  #initialize(AuxiliaryElements, boolean)} method allowing preliminary computation
36   *  such as truncation if needed.
37   *  </p>
38   *  <p>
39   *  Then the propagator will call at each step:
40   *  <ol>
41   *  <li>the {@link #initializeStep(AuxiliaryElements)} method.
42   *  The force model instance will extract all the elements needed before
43   *  computing the mean element rates.</li>
44   *  <li>the {@link #getMeanElementRate(SpacecraftState)} method.
45   *  The force model instance will extract all the state data needed to compute
46   *  the mean element rates that contribute to the mean state derivative.</li>
47   *  </ol>
48   *  </p>
49   *  <p>
50   *  The propagator will call the {@link #getShortPeriodicVariations(AbsoluteDate, double[])}
51   *  method at the end of the propagation in order to compute the short periodic
52   *  variations to be added to the mean elements to get the final state.
53   *  </p>
54   *
55   * @author Romain Di Constanzo
56   * @author Pascal Parraud
57   */
58  public interface DSSTForceModel {
59  
60      /** Performs initialization prior to propagation for the current force model.
61       *  <p>
62       *  This method aims at being called at the very beginning of a propagation.
63       *  </p>
64       *  @param aux auxiliary elements related to the current orbit
65       *  @param meanOnly only mean elements are used during the propagation
66       *  @throws OrekitException if some specific error occurs
67       */
68      void initialize(AuxiliaryElements aux, boolean meanOnly)
69          throws OrekitException;
70  
71      /** Performs initialization at each integration step for the current force model.
72       *  <p>
73       *  This method aims at being called before mean elements rates computation.
74       *  </p>
75       *  @param aux auxiliary elements related to the current orbit
76       *  @throws OrekitException if some specific error occurs
77       */
78      void initializeStep(AuxiliaryElements aux)
79          throws OrekitException;
80  
81      /** Computes the mean equinoctial elements rates da<sub>i</sub> / dt.
82       *
83       *  @param state current state information: date, kinematics, attitude
84       *  @return the mean element rates dai/dt
85       *  @throws OrekitException if some specific error occurs
86       */
87      double[] getMeanElementRate(SpacecraftState state) throws OrekitException;
88  
89      /** Computes the short periodic variations.
90       *
91       *  @param date current date
92       *  @param meanElements mean elements at current date
93       *  @return the short periodic variations
94       *  @throws OrekitException if some specific error occurs
95       */
96      double[] getShortPeriodicVariations(AbsoluteDate date, double[] meanElements)
97          throws OrekitException;
98  
99      /** Get the discrete events related to the model.
100      * @return array of events detectors or null if the model is not
101      * related to any discrete events
102      */
103     EventDetector[] getEventsDetectors();
104 
105     /** Register an attitude provider.
106      * <p>
107      * Register an attitude provider that can be used by the force model.
108      * </p>
109      * @param provider the {@link AttitudeProvider}
110      */
111     void registerAttitudeProvider(AttitudeProvider provider);
112 
113     /** Compute the coefficients used for short periodic variations.
114      *
115      * @param state current state information: date, kinematics, attitude
116      * @throws OrekitException if some specific error occurs
117      */
118     void computeShortPeriodicsCoefficients(SpacecraftState state) throws OrekitException;
119 
120     /** Reset the coefficients used for short periodic variations.
121      * <p>
122      * This method is aimed to reset short periodics coefficients.
123      * It is called when one goes from a interpolation step to the next one.
124      * </p>
125      */
126     void resetShortPeriodicsCoefficients();
127 }