FieldAdditionalEquations.java

  1. /* Copyright 2010-2011 Centre National d'Études Spatiales
  2.  * Licensed to CS GROUP (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.propagation.FieldSpacecraftState;
  20. import org.orekit.time.FieldAbsoluteDate;

  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.FieldNumericalPropagator 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.FieldNumericalPropagator#addAdditionalEquations(FieldAdditionalEquations)}
  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(FieldSpacecraftState,
  45.  * RealFieldElement[]) 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.FieldAdditionalStateProvider} interface.
  53.  * It allows to append various additional state parameters to any {@link
  54.  * org.orekit.propagation.numerical.FieldNumericalPropagator numerical propagator}.
  55.  * </p>
  56.  * @see AbstractIntegratedPropagator
  57.  * @see org.orekit.propagation.AdditionalStateProvider
  58.  * @author Luc Maisonobe
  59.  */
  60. public interface FieldAdditionalEquations<T extends RealFieldElement<T>> {

  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(FieldSpacecraftState , RealFieldElement[])}.
  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.      */
  81.     default void init(final FieldSpacecraftState<T> initialState, final FieldAbsoluteDate<T> target) {
  82.         // nothing by default
  83.     }

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

  101. }