EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2021 CS GROUP
  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.conversion;

  18. import org.orekit.attitudes.AttitudeProvider;
  19. import org.orekit.attitudes.InertialProvider;
  20. import org.orekit.forces.gravity.potential.GravityFieldFactory;
  21. import org.orekit.forces.gravity.potential.TideSystem;
  22. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  23. import org.orekit.orbits.Orbit;
  24. import org.orekit.orbits.OrbitType;
  25. import org.orekit.orbits.PositionAngle;
  26. import org.orekit.propagation.Propagator;
  27. import org.orekit.propagation.analytical.EcksteinHechlerPropagator;

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

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

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

  63.     /** Build a new instance.
  64.      * <p>
  65.      * The template orbit is used as a model to {@link
  66.      * #createInitialOrbit() create initial orbit}. It defines the
  67.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  68.      * used together with the {@code positionScale} to convert from the {@link
  69.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  70.      * callers of this builder to the real orbital parameters.
  71.      * </p>
  72.      * @param templateOrbit reference orbit from which real orbits will be built
  73.      * (note that the mu from this orbit will be overridden with the mu from the
  74.      * {@code provider})
  75.      * @param provider for un-normalized zonal coefficients
  76.      * @param positionAngle position angle type to use
  77.      * @param positionScale scaling factor used for orbital parameters normalization
  78.      * (typically set to the expected standard deviation of the position)
  79.      * @param attitudeProvider attitude law to use.
  80.      * @since 10.1
  81.      */
  82.     public EcksteinHechlerPropagatorBuilder(final Orbit templateOrbit,
  83.                                             final UnnormalizedSphericalHarmonicsProvider provider,
  84.                                             final PositionAngle positionAngle,
  85.                                             final double positionScale,
  86.                                             final AttitudeProvider attitudeProvider) {
  87.         super(overrideMu(templateOrbit, provider, positionAngle), positionAngle,
  88.                 positionScale, true, attitudeProvider);
  89.         this.provider = provider;
  90.     }

  91.     /** Build a new instance.
  92.      * <p>
  93.      * The template orbit is used as a model to {@link
  94.      * #createInitialOrbit() create initial orbit}. It defines the
  95.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  96.      * used together with the {@code positionScale} to convert from the {@link
  97.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  98.      * callers of this builder to the real orbital parameters.
  99.      * </p>
  100.      *
  101.      * @param templateOrbit reference orbit from which real orbits will be built
  102.      * (note that the mu from this orbit will be overridden with the mu from the
  103.      * {@code provider})
  104.      * @param referenceRadius reference radius of the Earth for the potential model (m)
  105.      * @param mu central attraction coefficient (m³/s²)
  106.      * @param tideSystem tide system
  107.      * @param c20 un-normalized zonal coefficient (about -1.08e-3 for Earth)
  108.      * @param c30 un-normalized zonal coefficient (about +2.53e-6 for Earth)
  109.      * @param c40 un-normalized zonal coefficient (about +1.62e-6 for Earth)
  110.      * @param c50 un-normalized zonal coefficient (about +2.28e-7 for Earth)
  111.      * @param c60 un-normalized zonal coefficient (about -5.41e-7 for Earth)
  112.      * @param orbitType orbit type to use
  113.      * @param positionAngle position angle type to use
  114.      * @param positionScale scaling factor used for orbital parameters normalization
  115.      * (typically set to the expected standard deviation of the position)
  116.      * @since 8.0
  117.      * @see #EcksteinHechlerPropagatorBuilder(Orbit,
  118.      * UnnormalizedSphericalHarmonicsProvider, PositionAngle, double, AttitudeProvider)
  119.      */
  120.     public EcksteinHechlerPropagatorBuilder(final Orbit templateOrbit,
  121.                                             final double referenceRadius,
  122.                                             final double mu,
  123.                                             final TideSystem tideSystem,
  124.                                             final double c20,
  125.                                             final double c30,
  126.                                             final double c40,
  127.                                             final double c50,
  128.                                             final double c60,
  129.                                             final OrbitType orbitType,
  130.                                             final PositionAngle positionAngle,
  131.                                             final double positionScale) {
  132.         this(templateOrbit,
  133.              GravityFieldFactory.getUnnormalizedProvider(referenceRadius, mu, tideSystem,
  134.                                                          new double[][] {
  135.                                                              {
  136.                                                                  0
  137.                                                              }, {
  138.                                                                  0
  139.                                                              }, {
  140.                                                                  c20
  141.                                                              }, {
  142.                                                                  c30
  143.                                                              }, {
  144.                                                                  c40
  145.                                                              }, {
  146.                                                                  c50
  147.                                                              }, {
  148.                                                                  c60
  149.                                                              }
  150.                                                          }, new double[][] {
  151.                                                              {
  152.                                                                  0
  153.                                                              }, {
  154.                                                                  0
  155.                                                              }, {
  156.                                                                  0
  157.                                                              }, {
  158.                                                                  0
  159.                                                              }, {
  160.                                                                  0
  161.                                                              }, {
  162.                                                                  0
  163.                                                              }, {
  164.                                                                  0
  165.                                                              }
  166.                                                          }),
  167.              positionAngle, positionScale);
  168.     }

  169.     /** Override central attraction coefficient.
  170.      * @param templateOrbit template orbit
  171.      * @param provider gravity field provider
  172.      * @param positionAngle position angle type to use
  173.      * @return orbit with overridden central attraction coefficient
  174.      */
  175.     private static Orbit overrideMu(final Orbit templateOrbit,
  176.                                     final UnnormalizedSphericalHarmonicsProvider provider,
  177.                                     final PositionAngle positionAngle) {
  178.         final double[] parameters    = new double[6];
  179.         final double[] parametersDot = templateOrbit.hasDerivatives() ? new double[6] : null;
  180.         templateOrbit.getType().mapOrbitToArray(templateOrbit, positionAngle, parameters, parametersDot);
  181.         return templateOrbit.getType().mapArrayToOrbit(parameters, parametersDot, positionAngle,
  182.                                                        templateOrbit.getDate(),
  183.                                                        provider.getMu(),
  184.                                                        templateOrbit.getFrame());
  185.     }

  186.     /** {@inheritDoc} */
  187.     public Propagator buildPropagator(final double[] normalizedParameters) {
  188.         setParameters(normalizedParameters);
  189.         return new EcksteinHechlerPropagator(createInitialOrbit(), getAttitudeProvider(),
  190.                 provider);
  191.     }

  192. }