KeplerianPropagatorBuilder.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.orbits.Orbit;
  21. import org.orekit.orbits.PositionAngleType;
  22. import org.orekit.propagation.Propagator;
  23. import org.orekit.propagation.analytical.KeplerianPropagator;


  24. /** Builder for Keplerian propagator.
  25.  * @author Pascal Parraud
  26.  * @since 6.0
  27.  */
  28. public class KeplerianPropagatorBuilder extends AbstractAnalyticalPropagatorBuilder<KeplerianPropagator> {

  29.     /** Build a new instance.
  30.      * <p>
  31.      * The template orbit is used as a model to {@link
  32.      * #createInitialOrbit() create initial orbit}. It defines the
  33.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  34.      * used together with the {@code positionScale} to convert from the {@link
  35.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  36.      * callers of this builder to the real orbital parameters.
  37.      * The default attitude provider is aligned with the orbit's inertial frame.
  38.      * </p>
  39.      *
  40.      * @param templateOrbit reference orbit from which real orbits will be built
  41.      * @param positionAngleType position angle type to use
  42.      * @param positionScale scaling factor used for orbital parameters normalization
  43.      * (typically set to the expected standard deviation of the position)
  44.      * @since 8.0
  45.      * @see #KeplerianPropagatorBuilder(Orbit, PositionAngleType, double, AttitudeProvider)
  46.      */
  47.     public KeplerianPropagatorBuilder(final Orbit templateOrbit, final PositionAngleType positionAngleType,
  48.                                       final double positionScale) {
  49.         this(templateOrbit, positionAngleType, positionScale,
  50.              FrameAlignedProvider.of(templateOrbit.getFrame()));
  51.     }

  52.     /** Build a new instance.
  53.      * <p>
  54.      * The template orbit is used as a model to {@link
  55.      * #createInitialOrbit() create initial orbit}. It defines the
  56.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  57.      * used together with the {@code positionScale} to convert from the {@link
  58.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  59.      * callers of this builder to the real orbital parameters.
  60.      * </p>
  61.      * @param templateOrbit reference orbit from which real orbits will be built
  62.      * @param positionAngleType position angle type to use
  63.      * @param positionScale scaling factor used for orbital parameters normalization
  64.      * (typically set to the expected standard deviation of the position)
  65.      * @param attitudeProvider attitude law to use.
  66.      * @since 10.1
  67.      */
  68.     public KeplerianPropagatorBuilder(final Orbit templateOrbit,
  69.                                       final PositionAngleType positionAngleType,
  70.                                       final double positionScale,
  71.                                       final AttitudeProvider attitudeProvider) {
  72.         super(templateOrbit, positionAngleType, positionScale, true, attitudeProvider, Propagator.DEFAULT_MASS);
  73.     }

  74.     /** {@inheritDoc} */
  75.     public KeplerianPropagator buildPropagator(final double[] normalizedParameters) {
  76.         setParameters(normalizedParameters);
  77.         final KeplerianPropagator propagator = new KeplerianPropagator(createInitialOrbit(), getAttitudeProvider(), getMu(), getMass());
  78.         getImpulseManeuvers().forEach(propagator::addEventDetector);
  79.         return propagator;
  80.     }
  81. }