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

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

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

  64.     /**
  65.      * Initialize the equations at the start of propagation.
  66.      *
  67.      * <p>
  68.      * This method will be called once at propagation start,
  69.      * before any calls to {@link #computeDerivatives(SpacecraftState, double[])}.
  70.      * </p>
  71.      *
  72.      * <p>
  73.      * The default implementation of this method does nothing.
  74.      * </p>
  75.      *
  76.      * @param initialState initial state information at the start of propagation.
  77.      * @param target       date of propagation. Not equal to {@code
  78.      *                     initialState.getDate()}.
  79.      */
  80.     default void init(final SpacecraftState initialState, final AbsoluteDate target) {
  81.         // nothing by default
  82.     }

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

  100. }