EcksteinHechlerPropagatorBuilder.java

  1. /* Copyright 2002-2022 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.InertialProvider;
  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.estimation.sequential.AbstractKalmanModel;
  26. import org.orekit.estimation.sequential.CovarianceMatrixProvider;
  27. import org.orekit.estimation.sequential.KalmanModel;
  28. import org.orekit.forces.gravity.potential.GravityFieldFactory;
  29. import org.orekit.forces.gravity.potential.TideSystem;
  30. import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
  31. import org.orekit.orbits.Orbit;
  32. import org.orekit.orbits.OrbitType;
  33. import org.orekit.orbits.PositionAngle;
  34. import org.orekit.propagation.Propagator;
  35. import org.orekit.propagation.analytical.EcksteinHechlerPropagator;
  36. import org.orekit.utils.ParameterDriversList;

  37. /** Builder for Eckstein-Hechler propagator.
  38.  * @author Pascal Parraud
  39.  * @since 6.0
  40.  */
  41. public class EcksteinHechlerPropagatorBuilder extends AbstractPropagatorBuilder implements OrbitDeterminationPropagatorBuilder {

  42.     /** Provider for un-normalized coefficients. */
  43.     private final UnnormalizedSphericalHarmonicsProvider provider;

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

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

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

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

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

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

  209.     /** {@inheritDoc} */
  210.     @Override
  211.     public AbstractKalmanModel buildKalmanModel(final List<OrbitDeterminationPropagatorBuilder> propagatorBuilders,
  212.                                                 final List<CovarianceMatrixProvider> covarianceMatricesProviders,
  213.                                                 final ParameterDriversList estimatedMeasurementsParameters,
  214.                                                 final CovarianceMatrixProvider measurementProcessNoiseMatrix) {
  215.         return new KalmanModel(propagatorBuilders, covarianceMatricesProviders, estimatedMeasurementsParameters, measurementProcessNoiseMatrix);
  216.     }

  217. }