EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2013 CS Systèmes d'Information
  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.conversion;

  18. import java.util.ArrayList;
  19. import java.util.Collection;

  20. import org.apache.commons.math3.exception.util.LocalizedFormats;
  21. import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
  22. import org.apache.commons.math3.ode.AbstractParameterizable;
  23. import org.orekit.errors.OrekitException;
  24. import org.orekit.forces.gravity.potential.GravityFieldFactory;
  25. import org.orekit.forces.gravity.potential.TideSystem;
  26. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  27. import org.orekit.frames.Frame;
  28. import org.orekit.orbits.CircularOrbit;
  29. import org.orekit.propagation.Propagator;
  30. import org.orekit.propagation.analytical.EcksteinHechlerPropagator;
  31. import org.orekit.time.AbsoluteDate;
  32. import org.orekit.utils.PVCoordinates;

  33. /** Builder for Eckstein-Hechler propagator.
  34.  * @author Pascal Parraud
  35.  * @since 6.0
  36.  */
  37. public class EcksteinHechlerPropagatorBuilder extends AbstractParameterizable
  38.                                               implements PropagatorBuilder {

  39.     /** Provider for un-normalized coefficients. */
  40.     private final UnnormalizedSphericalHarmonicsProvider provider;

  41.     /** Frame in which the orbit is propagated. */
  42.     private final Frame frame;

  43.     /** List of the free parameters names. */
  44.     private Collection<String> freeParameters;

  45.     /** Build a new instance.
  46.      * @param frame the frame in which the orbit is propagated
  47.      *        (<em>must</em> be a {@link Frame#isPseudoInertial pseudo-inertial frame})
  48.      * @param provider for un-normalized zonal coefficients
  49.      */
  50.     public EcksteinHechlerPropagatorBuilder(final Frame frame,
  51.                                             final UnnormalizedSphericalHarmonicsProvider provider) {
  52.         this.frame    = frame;
  53.         this.provider = provider;
  54.     }

  55.     /** Build a new instance.
  56.      * @param frame the frame in which the orbit is propagated
  57.      *        (<em>must</em> be a {@link Frame#isPseudoInertial pseudo-inertial frame})
  58.      * @param referenceRadius reference radius of the Earth for the potential model (m)
  59.      * @param mu central attraction coefficient (m<sup>3</sup>/s<sup>2</sup>)
  60.      * @param tideSystem tide system
  61.      * @param c20 un-normalized zonal coefficient (about -1.08e-3 for Earth)
  62.      * @param c30 un-normalized zonal coefficient (about +2.53e-6 for Earth)
  63.      * @param c40 un-normalized zonal coefficient (about +1.62e-6 for Earth)
  64.      * @param c50 un-normalized zonal coefficient (about +2.28e-7 for Earth)
  65.      * @param c60 un-normalized zonal coefficient (about -5.41e-7 for Earth)
  66.      */
  67.     public EcksteinHechlerPropagatorBuilder(final Frame frame,
  68.                                             final double referenceRadius,
  69.                                             final double mu,
  70.                                             final TideSystem tideSystem,
  71.                                             final double c20,
  72.                                             final double c30,
  73.                                             final double c40,
  74.                                             final double c50,
  75.                                             final double c60) {
  76.         this(frame,
  77.              GravityFieldFactory.getUnnormalizedProvider(referenceRadius, mu, tideSystem,
  78.                                                          new double[][] {
  79.                                                              {
  80.                                                                  0
  81.                                                              }, {
  82.                                                                  0
  83.                                                              }, {
  84.                                                                  c20
  85.                                                              }, {
  86.                                                                  c30
  87.                                                              }, {
  88.                                                                  c40
  89.                                                              }, {
  90.                                                                  c50
  91.                                                              }, {
  92.                                                                  c60
  93.                                                              }
  94.                                                          }, new double[][] {
  95.                                                              {
  96.                                                                  0
  97.                                                              }, {
  98.                                                                  0
  99.                                                              }, {
  100.                                                                  0
  101.                                                              }, {
  102.                                                                  0
  103.                                                              }, {
  104.                                                                  0
  105.                                                              }, {
  106.                                                                  0
  107.                                                              }, {
  108.                                                                  0
  109.                                                              }
  110.                                                          }));
  111.     }

  112.     /** {@inheritDoc} */
  113.     public Propagator buildPropagator(final AbsoluteDate date, final double[] parameters)
  114.         throws OrekitException {

  115.         if (parameters.length != (freeParameters.size() + 6)) {
  116.             throw OrekitException.createIllegalArgumentException(LocalizedFormats.DIMENSIONS_MISMATCH);
  117.         }

  118.         final CircularOrbit orb = new CircularOrbit(new PVCoordinates(new Vector3D(parameters[0],
  119.                                                                                    parameters[1],
  120.                                                                                    parameters[2]),
  121.                                                                       new Vector3D(parameters[3],
  122.                                                                                    parameters[4],
  123.                                                                                    parameters[5])),
  124.                                                     frame, date, provider.getMu());

  125.         return new EcksteinHechlerPropagator(orb, provider);
  126.     }

  127.     /** {@inheritDoc} */
  128.     public Frame getFrame() {
  129.         return frame;
  130.     }

  131.     /** {@inheritDoc} */
  132.     public void setFreeParameters(final Collection<String> parameters)
  133.         throws IllegalArgumentException {
  134.         freeParameters = new ArrayList<String>();
  135.         for (String name : parameters) {
  136.             complainIfNotSupported(name);
  137.         }
  138.         freeParameters.addAll(parameters);
  139.     }

  140.     /** {@inheritDoc} */
  141.     public double getParameter(final String name)
  142.         throws IllegalArgumentException {
  143.         return 0;
  144.     }

  145.     /** {@inheritDoc} */
  146.     public void setParameter(final String name, final double value)
  147.         throws IllegalArgumentException {
  148.     }

  149. }