AdditionalEquations.java

  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. import org.orekit.errors.OrekitException;
  19. import org.orekit.propagation.SpacecraftState;
  20. import org.orekit.time.AbsoluteDate;

  21. /** This interface allows users to add their own differential equations to a numerical propagator.
  22.  *
  23.  * <p>
  24.  * In some cases users may need to integrate some problem-specific equations along with
  25.  * classical spacecraft equations of motions. One example is optimal control in low
  26.  * thrust where adjoint parameters linked to the minimized Hamiltonian must be integrated.
  27.  * Another example is formation flying or rendez-vous which use the Clohessy-Whiltshire
  28.  * equations for the relative motion.
  29.  * </p>
  30.  * <p>
  31.  * This interface allows users to add such equations to a {@link
  32.  * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}. Users provide the
  33.  * equations as an implementation of this interface and register it to the propagator thanks to
  34.  * its {@link org.orekit.propagation.numerical.NumericalPropagator#addAdditionalEquations(AdditionalEquations)}
  35.  * method. Several such objects can be registered with each numerical propagator, but it is
  36.  * recommended to gather in the same object the sets of parameters which equations can interact
  37.  * on each others states.
  38.  * </p>
  39.  * <p>
  40.  * The additional parameters are gathered in a simple p array. The additional equations compute
  41.  * the pDot array, which is the time-derivative of the p array. Since the additional parameters
  42.  * p may also have an influence on the equations of motion themselves that should be accumulated
  43.  * to the main state derivatives (for example an equation linked to a complex thrust model may
  44.  * induce an acceleration and a mass change), the {@link #computeDerivatives(SpacecraftState, double[])
  45.  * computeDerivatives} method can return a double array that will be
  46.  * <em>added</em> to the main state derivatives. This means these equations can be used as an
  47.  * additional force model if needed. If the additional parameters have no influence at all on
  48.  * the main spacecraft state, a null reference may be returned.
  49.  * </p>
  50.  * <p>
  51.  * This interface is the numerical (read not already integrated) counterpart of
  52.  * the {@link org.orekit.propagation.AdditionalStateProvider} interface.
  53.  * It allows to append various additional state parameters to any {@link
  54.  * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}.
  55.  * </p>
  56.  * @see AbstractIntegratedPropagator
  57.  * @see org.orekit.propagation.AdditionalStateProvider
  58.  * @author Luc Maisonobe
  59.  */
  60. public interface AdditionalEquations {

  61.     /** Get the name of the additional state.
  62.      * @return name of the additional state
  63.      */
  64.     String getName();

  65.     /**
  66.      * Initialize the equations at the start of propagation.
  67.      *
  68.      * <p>
  69.      * This method will be called once at propagation start,
  70.      * before any calls to {@link #computeDerivatives(SpacecraftState)}.
  71.      * </p>
  72.      *
  73.      * <p>
  74.      * The default implementation of this method does nothing.
  75.      * </p>
  76.      *
  77.      * @param initialState initial state information at the start of propagation.
  78.      * @param target       date of propagation. Not equal to {@code
  79.      *                     initialState.getDate()}.
  80.      * @throws OrekitException if there is an Orekit related error during
  81.      *                         initialization.
  82.      */
  83.     default void init(final SpacecraftState initialState, final AbsoluteDate target)
  84.         throws OrekitException {
  85.         // nothing by default
  86.     }

  87.     /** Compute the derivatives related to the additional state parameters.
  88.      * <p>
  89.      * When this method is called, the spacecraft state contains the main
  90.      * state (orbit, attitude and mass), all the states provided through
  91.      * the {@link org.orekit.propagation.AdditionalStateProvider additional
  92.      * state providers} registered to the propagator, and the additional state
  93.      * integrated using this equation. It does <em>not</em> contains any other
  94.      * states to be integrated alongside during the same propagation.
  95.      * </p>
  96.      * @param s current state information: date, kinematics, attitude, and
  97.      * additional state
  98.      * @param pDot placeholder where the derivatives of the additional parameters
  99.      * should be put
  100.      * @return cumulative effect of the equations on the main state (may be null if
  101.      * equations do not change main state at all)
  102.      * @exception OrekitException if some specific error occurs
  103.      */
  104.     double[] computeDerivatives(SpacecraftState s,  double[] pDot)
  105.         throws OrekitException;

  106. }