1   /* Copyright 2002-2021 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  
19  import org.orekit.attitudes.AttitudeProvider;
20  import org.orekit.attitudes.InertialProvider;
21  import org.orekit.orbits.Orbit;
22  import org.orekit.orbits.PositionAngle;
23  import org.orekit.propagation.Propagator;
24  import org.orekit.propagation.analytical.KeplerianPropagator;
25  
26  /** Builder for Keplerian propagator.
27   * @author Pascal Parraud
28   * @since 6.0
29   */
30  public class KeplerianPropagatorBuilder extends AbstractPropagatorBuilder {
31  
32      /** Build a new instance.
33       * <p>
34       * The template orbit is used as a model to {@link
35       * #createInitialOrbit() create initial orbit}. It defines the
36       * inertial frame, the central attraction coefficient, the orbit type, and is also
37       * used together with the {@code positionScale} to convert from the {@link
38       * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
39       * callers of this builder to the real orbital parameters.
40       * </p>
41       *
42       * @param templateOrbit reference orbit from which real orbits will be built
43       * @param positionAngle position angle type to use
44       * @param positionScale scaling factor used for orbital parameters normalization
45       * (typically set to the expected standard deviation of the position)
46       * @since 8.0
47       * @see #KeplerianPropagatorBuilder(Orbit, PositionAngle, double, AttitudeProvider)
48       */
49      public KeplerianPropagatorBuilder(final Orbit templateOrbit, final PositionAngle positionAngle,
50                                        final double positionScale) {
51          this(templateOrbit, positionAngle, positionScale,
52                  InertialProvider.of(templateOrbit.getFrame()));
53      }
54  
55      /** Build a new instance.
56       * <p>
57       * The template orbit is used as a model to {@link
58       * #createInitialOrbit() create initial orbit}. It defines the
59       * inertial frame, the central attraction coefficient, the orbit type, and is also
60       * used together with the {@code positionScale} to convert from the {@link
61       * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
62       * callers of this builder to the real orbital parameters.
63       * </p>
64       * @param templateOrbit reference orbit from which real orbits will be built
65       * @param positionAngle position angle type to use
66       * @param positionScale scaling factor used for orbital parameters normalization
67       * (typically set to the expected standard deviation of the position)
68       * @param attitudeProvider attitude law to use.
69       * @since 10.1
70       */
71      public KeplerianPropagatorBuilder(final Orbit templateOrbit,
72                                        final PositionAngle positionAngle,
73                                        final double positionScale,
74                                        final AttitudeProvider attitudeProvider) {
75          super(templateOrbit, positionAngle, positionScale, true, attitudeProvider);
76      }
77  
78      /** {@inheritDoc} */
79      public Propagator buildPropagator(final double[] normalizedParameters) {
80          setParameters(normalizedParameters);
81          return new KeplerianPropagator(createInitialOrbit(), getAttitudeProvider());
82      }
83  
84  }