EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2025 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.FrameAlignedProvider;
  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.PositionAngleType;
  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 AbstractAnalyticalPropagatorBuilder<EcksteinHechlerPropagator> {

  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.      * The default attitude provider is aligned with the orbit's inertial frame.
  44.      * </p>
  45.      *
  46.      * @param templateOrbit reference orbit from which real orbits will be built
  47.      * (note that the mu from this orbit will be overridden with the mu from the
  48.      * {@code provider})
  49.      * @param provider for un-normalized zonal coefficients
  50.      * @param positionAngleType position angle type to use
  51.      * @param positionScale scaling factor used for orbital parameters normalization
  52.      * (typically set to the expected standard deviation of the position)
  53.      * @since 8.0
  54.      * @see #EcksteinHechlerPropagatorBuilder(Orbit,
  55.      * UnnormalizedSphericalHarmonicsProvider, PositionAngleType, double, AttitudeProvider)
  56.      */
  57.     public EcksteinHechlerPropagatorBuilder(final Orbit templateOrbit,
  58.                                             final UnnormalizedSphericalHarmonicsProvider provider,
  59.                                             final PositionAngleType positionAngleType,
  60.                                             final double positionScale) {
  61.         this(templateOrbit, provider, positionAngleType, positionScale,
  62.              FrameAlignedProvider.of(templateOrbit.getFrame()));
  63.     }

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

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

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

  187.     /** {@inheritDoc} */
  188.     public EcksteinHechlerPropagator buildPropagator(final double[] normalizedParameters) {
  189.         setParameters(normalizedParameters);
  190.         final EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(createInitialOrbit(), getAttitudeProvider(),
  191.             getMass(), provider);
  192.         getImpulseManeuvers().forEach(propagator::addEventDetector);
  193.         return propagator;
  194.     }

  195. }