EphemerisPropagatorBuilder.java

  1. /* Copyright 2022 Bryan Cazabonne
  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.  * Bryan Cazabonne 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.estimation.leastsquares.AbstractBatchLSModel;
  21. import org.orekit.estimation.leastsquares.BatchLSModel;
  22. import org.orekit.estimation.leastsquares.ModelObserver;
  23. import org.orekit.estimation.measurements.ObservedMeasurement;
  24. import org.orekit.estimation.sequential.AbstractKalmanModel;
  25. import org.orekit.estimation.sequential.CovarianceMatrixProvider;
  26. import org.orekit.estimation.sequential.KalmanModel;
  27. import org.orekit.orbits.PositionAngle;
  28. import org.orekit.propagation.Propagator;
  29. import org.orekit.propagation.SpacecraftState;
  30. import org.orekit.propagation.analytical.Ephemeris;
  31. import org.orekit.utils.ParameterDriversList;

  32. /** Builder for Ephemeris propagator.
  33.  * @author Bryan Cazabonne
  34.  * @since 11.3
  35.  */
  36. public class EphemerisPropagatorBuilder extends AbstractPropagatorBuilder implements OrbitDeterminationPropagatorBuilder {

  37.     /** Default position scale (not used for ephemeris based estimation). */
  38.     private static final double DEFAULT_SCALE = 10.0;

  39.     /** List of spacecraft states. */
  40.     private final List<SpacecraftState> states;

  41.     /** The extrapolation threshold beyond which the propagation will fail. **/
  42.     private final double extrapolationThreshold;

  43.     /** Number of points to use in interpolation. */
  44.     private final int interpolationPoints;

  45.     /** Attitude provider. */
  46.     private final AttitudeProvider provider;

  47.     /** Constructor.
  48.      * @param states list of spacecraft states
  49.      * @param interpolationPoints number of points to use in interpolation
  50.      * @param extrapolationThreshold the extrapolation threshold beyond which the propagation will fail
  51.      * @param attitudeProvider attitude provider
  52.      */
  53.     public EphemerisPropagatorBuilder(final List<SpacecraftState> states,
  54.                                       final int interpolationPoints,
  55.                                       final double extrapolationThreshold,
  56.                                       final AttitudeProvider attitudeProvider) {
  57.         super(states.get(0).getOrbit(), PositionAngle.TRUE, DEFAULT_SCALE, false, attitudeProvider);
  58.         deselectDynamicParameters();
  59.         this.states                 = states;
  60.         this.interpolationPoints    = interpolationPoints;
  61.         this.extrapolationThreshold = extrapolationThreshold;
  62.         this.provider               = attitudeProvider;
  63.     }

  64.     /** {@inheritDoc}. */
  65.     @Override
  66.     public Propagator buildPropagator(final double[] normalizedParameters) {
  67.         return new Ephemeris(states, interpolationPoints, extrapolationThreshold, provider);
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     public AbstractBatchLSModel buildLSModel(final OrbitDeterminationPropagatorBuilder[] builders,
  72.                                              final List<ObservedMeasurement<?>> measurements,
  73.                                              final ParameterDriversList estimatedMeasurementsParameters,
  74.                                              final ModelObserver observer) {
  75.         return new BatchLSModel(builders, measurements, estimatedMeasurementsParameters, observer);
  76.     }

  77.     /** {@inheritDoc} */
  78.     @Override
  79.     public AbstractKalmanModel buildKalmanModel(final List<OrbitDeterminationPropagatorBuilder> propagatorBuilders,
  80.                                                 final List<CovarianceMatrixProvider> covarianceMatricesProviders,
  81.                                                 final ParameterDriversList estimatedMeasurementsParameters,
  82.                                                 final CovarianceMatrixProvider measurementProcessNoiseMatrix) {
  83.         return new KalmanModel(propagatorBuilders, covarianceMatricesProviders, estimatedMeasurementsParameters, measurementProcessNoiseMatrix);
  84.     }

  85. }