EcksteinHechlerPropagatorBuilder.java

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

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

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

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

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

  133.     /** Override central attraction coefficient.
  134.      * @param templateOrbit template orbit
  135.      * @param provider gravity field provider
  136.      * @param positionAngle position angle type to use
  137.      * @return orbit with overridden central attraction coefficient
  138.      */
  139.     private static Orbit overrideMu(final Orbit templateOrbit,
  140.                                     final UnnormalizedSphericalHarmonicsProvider provider,
  141.                                     final PositionAngle positionAngle) {
  142.         final double[] parameters    = new double[6];
  143.         final double[] parametersDot = templateOrbit.hasDerivatives() ? new double[6] : null;
  144.         templateOrbit.getType().mapOrbitToArray(templateOrbit, positionAngle, parameters, parametersDot);
  145.         return templateOrbit.getType().mapArrayToOrbit(parameters, parametersDot, positionAngle,
  146.                                                        templateOrbit.getDate(),
  147.                                                        provider.getMu(),
  148.                                                        templateOrbit.getFrame());
  149.     }

  150.     /** {@inheritDoc} */
  151.     public Propagator buildPropagator(final double[] normalizedParameters) {
  152.         setParameters(normalizedParameters);
  153.         return new EcksteinHechlerPropagator(createInitialOrbit(), provider);
  154.     }

  155. }