EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2024 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 java.util.List;

  19. import org.orekit.attitudes.AttitudeProvider;
  20. import org.orekit.attitudes.FrameAlignedProvider;
  21. import org.orekit.estimation.leastsquares.AbstractBatchLSModel;
  22. import org.orekit.estimation.leastsquares.BatchLSModel;
  23. import org.orekit.estimation.leastsquares.ModelObserver;
  24. import org.orekit.estimation.measurements.ObservedMeasurement;
  25. import org.orekit.forces.gravity.potential.GravityFieldFactory;
  26. import org.orekit.forces.gravity.potential.TideSystem;
  27. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  28. import org.orekit.orbits.Orbit;
  29. import org.orekit.orbits.OrbitType;
  30. import org.orekit.orbits.PositionAngleType;
  31. import org.orekit.propagation.Propagator;
  32. import org.orekit.propagation.analytical.EcksteinHechlerPropagator;
  33. import org.orekit.utils.ParameterDriversList;

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

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

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

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

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

  176.     /** Override central attraction coefficient.
  177.      * @param templateOrbit template orbit
  178.      * @param provider gravity field provider
  179.      * @param positionAngleType position angle type to use
  180.      * @return orbit with overridden central attraction coefficient
  181.      */
  182.     private static Orbit overrideMu(final Orbit templateOrbit,
  183.                                     final UnnormalizedSphericalHarmonicsProvider provider,
  184.                                     final PositionAngleType positionAngleType) {
  185.         final double[] parameters    = new double[6];
  186.         final double[] parametersDot = templateOrbit.hasDerivatives() ? new double[6] : null;
  187.         templateOrbit.getType().mapOrbitToArray(templateOrbit, positionAngleType, parameters, parametersDot);
  188.         return templateOrbit.getType().mapArrayToOrbit(parameters, parametersDot, positionAngleType,
  189.                                                        templateOrbit.getDate(),
  190.                                                        provider.getMu(),
  191.                                                        templateOrbit.getFrame());
  192.     }

  193.     /** {@inheritDoc} */
  194.     public Propagator buildPropagator(final double[] normalizedParameters) {
  195.         setParameters(normalizedParameters);
  196.         return new EcksteinHechlerPropagator(createInitialOrbit(), getAttitudeProvider(),
  197.                 provider);
  198.     }

  199.     /** {@inheritDoc} */
  200.     @Override
  201.     public AbstractBatchLSModel buildLeastSquaresModel(final PropagatorBuilder[] builders,
  202.                                                        final List<ObservedMeasurement<?>> measurements,
  203.                                                        final ParameterDriversList estimatedMeasurementsParameters,
  204.                                                        final ModelObserver observer) {
  205.         return new BatchLSModel(builders, measurements, estimatedMeasurementsParameters, observer);
  206.     }

  207.     /** {@inheritDoc} */
  208.     @Override
  209.     public EcksteinHechlerPropagatorBuilder copy() {
  210.         return new EcksteinHechlerPropagatorBuilder(createInitialOrbit(), provider, getPositionAngleType(),
  211.                                                     getPositionScale(), getAttitudeProvider());
  212.     }
  213. }