1   /* Copyright 2002-2026 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.analytical.tle.generation;
18  
19  import org.orekit.annotation.DefaultDataContext;
20  import org.orekit.data.DataContext;
21  import org.orekit.frames.Frame;
22  import org.orekit.propagation.analytical.tle.TLE;
23  import org.orekit.propagation.conversion.osc2mean.FixedPointConverter;
24  import org.orekit.propagation.conversion.osc2mean.TLETheory;
25  import org.orekit.time.TimeScale;
26  
27  /**
28   * Fixed Point method to reverse SGP4 and SDP4 propagation algorithm
29   * and generate a usable TLE from a spacecraft state.
30   * <p>
31   * Using this algorithm, the B* value is not computed. In other words,
32   * the B* value from the template TLE is set to the generated one.
33   * </p>
34   * @author Thomas Paulet
35   * @author Bryan Cazabonne
36   * @since 12.0
37   */
38  public class FixedPointTleGenerationAlgorithm extends TleGenerationAlgorithm {
39  
40      /** Default value for epsilon. */
41      public static final double EPSILON_DEFAULT = 1.0e-10;
42  
43      /** Default value for maxIterations. */
44      public static final int MAX_ITERATIONS_DEFAULT = 100;
45  
46      /** Default value for scale. */
47      public static final double SCALE_DEFAULT = 1.0;
48  
49      /**
50       * Default constructor.
51       * <p>
52       * Uses the {@link DataContext#getDefault() default data context}
53       * as well as {@link #EPSILON_DEFAULT}, {@link #MAX_ITERATIONS_DEFAULT},
54       * {@link #SCALE_DEFAULT} for method convergence.
55       * </p>
56       * @param templateTLE template TLE
57       * @since 14.0
58       */
59      @DefaultDataContext
60      public FixedPointTleGenerationAlgorithm(final TLE templateTLE) {
61          this(templateTLE, EPSILON_DEFAULT, MAX_ITERATIONS_DEFAULT, SCALE_DEFAULT);
62      }
63  
64      /**
65       * Constructor.
66       * <p>
67       * Uses the {@link DataContext#getDefault() default data context}.
68       * </p>
69       * @param templateTLE template TLE
70       * @param epsilon used to compute threshold for convergence check
71       * @param maxIterations maximum number of iterations for convergence
72       * @param scale scale factor of the Fixed Point algorithm
73       * @since 14.0
74       */
75      @DefaultDataContext
76      public FixedPointTleGenerationAlgorithm(final TLE templateTLE,
77                                              final double epsilon,
78                                              final int maxIterations,
79                                              final double scale) {
80          this(templateTLE, epsilon, maxIterations, scale,
81               DataContext.getDefault().getTimeScales().getUTC(),
82               DataContext.getDefault().getFrames().getTEME());
83      }
84  
85      /**
86       * Constructor.
87       * @param templateTLE template TLE
88       * @param epsilon used to compute threshold for convergence check
89       * @param maxIterations maximum number of iterations for convergence
90       * @param scale scale factor of the Fixed Point algorithm
91       * @param utc UTC time scale
92       * @param teme TEME frame
93       * @since 14.0
94       */
95      public FixedPointTleGenerationAlgorithm(final TLE templateTLE,
96                                              final double epsilon,
97                                              final int maxIterations,
98                                              final double scale,
99                                              final TimeScale utc,
100                                             final Frame teme) {
101         super(templateTLE, teme,
102               new FixedPointConverter(new TLETheory(utc, teme), epsilon, maxIterations, scale));
103     }
104 
105 }