EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2018 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 org.orekit.errors.OrekitException;
  19. import org.orekit.forces.gravity.potential.GravityFieldFactory;
  20. import org.orekit.forces.gravity.potential.TideSystem;
  21. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  22. import org.orekit.orbits.Orbit;
  23. import org.orekit.orbits.OrbitType;
  24. import org.orekit.orbits.PositionAngle;
  25. import org.orekit.propagation.Propagator;
  26. import org.orekit.propagation.analytical.EcksteinHechlerPropagator;

  27. /** Builder for Eckstein-Hechler propagator.
  28.  * @author Pascal Parraud
  29.  * @since 6.0
  30.  */
  31. public class EcksteinHechlerPropagatorBuilder extends AbstractPropagatorBuilder {

  32.     /** Provider for un-normalized coefficients. */
  33.     private final UnnormalizedSphericalHarmonicsProvider provider;

  34.     /** Build a new instance.
  35.      * <p>
  36.      * The template orbit is used as a model to {@link
  37.      * #createInitialOrbit() create initial orbit}. It defines the
  38.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  39.      * used together with the {@code positionScale} to convert from the {@link
  40.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  41.      * callers of this builder to the real orbital parameters.
  42.      * </p>
  43.      * @param templateOrbit reference orbit from which real orbits will be built
  44.      * (note that the mu from this orbit will be overridden with the mu from the
  45.      * {@code provider})
  46.      * @param provider for un-normalized zonal coefficients
  47.      * @param positionAngle position angle type to use
  48.      * @param positionScale scaling factor used for orbital parameters normalization
  49.      * (typically set to the expected standard deviation of the position)
  50.      * @exception OrekitException if parameters drivers cannot be scaled
  51.      * @since 8.0
  52.      */
  53.     public EcksteinHechlerPropagatorBuilder(final Orbit templateOrbit,
  54.                                             final UnnormalizedSphericalHarmonicsProvider provider,
  55.                                             final PositionAngle positionAngle,
  56.                                             final double positionScale)
  57.         throws OrekitException {
  58.         super(overrideMu(templateOrbit, provider, positionAngle), positionAngle, positionScale, true);
  59.         this.provider = provider;
  60.     }

  61.     /** Build a new instance.
  62.      * <p>
  63.      * The template orbit is used as a model to {@link
  64.      * #createInitialOrbit() create initial orbit}. It defines the
  65.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  66.      * used together with the {@code positionScale} to convert from the {@link
  67.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  68.      * callers of this builder to the real orbital parameters.
  69.      * </p>
  70.      * @param templateOrbit reference orbit from which real orbits will be built
  71.      * (note that the mu from this orbit will be overridden with the mu from the
  72.      * {@code provider})
  73.      * @param referenceRadius reference radius of the Earth for the potential model (m)
  74.      * @param mu central attraction coefficient (m³/s²)
  75.      * @param tideSystem tide system
  76.      * @param c20 un-normalized zonal coefficient (about -1.08e-3 for Earth)
  77.      * @param c30 un-normalized zonal coefficient (about +2.53e-6 for Earth)
  78.      * @param c40 un-normalized zonal coefficient (about +1.62e-6 for Earth)
  79.      * @param c50 un-normalized zonal coefficient (about +2.28e-7 for Earth)
  80.      * @param c60 un-normalized zonal coefficient (about -5.41e-7 for Earth)
  81.      * @param orbitType orbit type to use
  82.      * @param positionAngle position angle type to use
  83.      * @param positionScale scaling factor used for orbital parameters normalization
  84.      * (typically set to the expected standard deviation of the position)
  85.      * @exception OrekitException if parameters drivers cannot be scaled
  86.      * @since 8.0
  87.      */
  88.     public EcksteinHechlerPropagatorBuilder(final Orbit templateOrbit,
  89.                                             final double referenceRadius,
  90.                                             final double mu,
  91.                                             final TideSystem tideSystem,
  92.                                             final double c20,
  93.                                             final double c30,
  94.                                             final double c40,
  95.                                             final double c50,
  96.                                             final double c60,
  97.                                             final OrbitType orbitType,
  98.                                             final PositionAngle positionAngle,
  99.                                             final double positionScale)
  100.         throws OrekitException {
  101.         this(templateOrbit,
  102.              GravityFieldFactory.getUnnormalizedProvider(referenceRadius, mu, tideSystem,
  103.                                                          new double[][] {
  104.                                                              {
  105.                                                                  0
  106.                                                              }, {
  107.                                                                  0
  108.                                                              }, {
  109.                                                                  c20
  110.                                                              }, {
  111.                                                                  c30
  112.                                                              }, {
  113.                                                                  c40
  114.                                                              }, {
  115.                                                                  c50
  116.                                                              }, {
  117.                                                                  c60
  118.                                                              }
  119.                                                          }, new double[][] {
  120.                                                              {
  121.                                                                  0
  122.                                                              }, {
  123.                                                                  0
  124.                                                              }, {
  125.                                                                  0
  126.                                                              }, {
  127.                                                                  0
  128.                                                              }, {
  129.                                                                  0
  130.                                                              }, {
  131.                                                                  0
  132.                                                              }, {
  133.                                                                  0
  134.                                                              }
  135.                                                          }),
  136.              positionAngle, positionScale);
  137.     }

  138.     /** Override central attraction coefficient.
  139.      * @param templateOrbit template orbit
  140.      * @param provider gravity field provider
  141.      * @param positionAngle position angle type to use
  142.      * @return orbit with overridden central attraction coefficient
  143.      * @exception OrekitException if orbit cannot be converted
  144.      */
  145.     private static Orbit overrideMu(final Orbit templateOrbit,
  146.                                     final UnnormalizedSphericalHarmonicsProvider provider,
  147.                                     final PositionAngle positionAngle)
  148.         throws OrekitException {
  149.         final double[] parameters    = new double[6];
  150.         final double[] parametersDot = templateOrbit.hasDerivatives() ? new double[6] : null;
  151.         templateOrbit.getType().mapOrbitToArray(templateOrbit, positionAngle, parameters, parametersDot);
  152.         return templateOrbit.getType().mapArrayToOrbit(parameters, parametersDot, positionAngle,
  153.                                                        templateOrbit.getDate(),
  154.                                                        provider.getMu(),
  155.                                                        templateOrbit.getFrame());
  156.     }

  157.     /** {@inheritDoc} */
  158.     public Propagator buildPropagator(final double[] normalizedParameters)
  159.         throws OrekitException {
  160.         setParameters(normalizedParameters);
  161.         return new EcksteinHechlerPropagator(createInitialOrbit(), provider);
  162.     }

  163. }