FieldAdditionalEquations.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.hipparchus.RealFieldElement;
  19. import org.orekit.errors.OrekitException;
  20. import org.orekit.propagation.FieldSpacecraftState;
  21. import org.orekit.propagation.SpacecraftState;
  22. import org.orekit.time.FieldAbsoluteDate;

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

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

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

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

  108. }