1   /* Copyright 2010-2011 Centre National d'Études Spatiales
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.integration;
18  
19  import org.orekit.errors.OrekitException;
20  import org.orekit.propagation.SpacecraftState;
21  
22  /** This interface allows users to add their own differential equations to a numerical propagator.
23   *
24   * <p>
25   * In some cases users may need to integrate some problem-specific equations along with
26   * classical spacecraft equations of motions. One example is optimal control in low
27   * thrust where adjoint parameters linked to the minimized Hamiltonian must be integrated.
28   * Another example is formation flying or rendez-vous which use the Clohessy-Whiltshire
29   * equations for the relative motion.
30   * </p>
31   * <p>
32   * This interface allows users to add such equations to a {@link
33   * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}. Users provide the
34   * equations as an implementation of this interface and register it to the propagator thanks to
35   * its {@link org.orekit.propagation.numerical.NumericalPropagator#addAdditionalEquations(AdditionalEquations)}
36   * method. Several such objects can be registered with each numerical propagator, but it is
37   * recommended to gather in the same object the sets of parameters which equations can interact
38   * on each others states.
39   * </p>
40   * <p>
41   * The additional parameters are gathered in a simple p array. The additional equations compute
42   * the pDot array, which is the time-derivative of the p array. Since the additional parameters
43   * p may also have an influence on the equations of motion themselves that should be accumulated
44   * to the main state derivatives (for example an equation linked to a complex thrust model may
45   * induce an acceleration and a mass change), the {@link #computeDerivatives(SpacecraftState, double[])
46   * computeDerivatives} method can return a double array that will be
47   * <em>added</em> to the main state derivatives. This means these equations can be used as an
48   * additional force model if needed. If the additional parameters have no influence at all on
49   * the main spacecraft state, a null reference may be returned.
50   * </p>
51   * <p>
52   * This interface is the numerical (read not already integrated) counterpart of
53   * the {@link org.orekit.propagation.AdditionalStateProvider} interface.
54   * It allows to append various additional state parameters to any {@link
55   * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}.
56   * </p>
57   * @see AbstractIntegratedPropagator
58   * @see org.orekit.propagation.AdditionalStateProvider
59   * @author Luc Maisonobe
60   */
61  public interface AdditionalEquations {
62  
63      /** Get the name of the additional state.
64       * @return name of the additional state
65       */
66      String getName();
67  
68      /** Compute the derivatives related to the additional state parameters.
69       * <p>
70       * When this method is called, the spacecraft state contains the main
71       * state (orbit, attitude and mass), all the states provided through
72       * the {@link org.orekit.propagation.AdditionalStateProvider additional
73       * state providers} registered to the propagator, and the additional state
74       * integrated using this equation. It does <em>not</em> contains any other
75       * states to be integrated alongside during the same propagation.
76       * </p>
77       * @param s current state information: date, kinematics, attitude, and
78       * additional state
79       * @param pDot placeholder where the derivatives of the additional parameters
80       * should be put
81       * @return cumulative effect of the equations on the main state (may be null if
82       * equations do not change main state at all)
83       * @exception OrekitException if some specific error occurs
84       */
85      double[] computeDerivatives(SpacecraftState s,  double[] pDot)
86          throws OrekitException;
87  
88  }