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;
18
19 import org.hipparchus.linear.RealMatrix;
20 import org.orekit.orbits.PositionAngleType;
21 import org.orekit.propagation.SpacecraftState;
22 import org.orekit.propagation.analytical.AbstractAnalyticalGradientConverter;
23 import org.orekit.propagation.analytical.AbstractAnalyticalMatricesHarvester;
24 import org.orekit.utils.DoubleArrayDictionary;
25
26 /** Harvester between two-dimensional Jacobian matrices and
27 * one-dimensional {@link TLEPropagator}.
28 * @author Thomas Paulet
29 * @author Bryan Cazabonne
30 * @since 11.1
31 */
32 class TLEHarvester extends AbstractAnalyticalMatricesHarvester {
33
34 /** Propagator bound to this harvester. */
35 private final TLEPropagator propagator;
36
37 /** Simple constructor.
38 * <p>
39 * The arguments for initial matrices <em>must</em> be compatible with the
40 * {@link org.orekit.orbits.OrbitType orbit type}
41 * and {@link PositionAngleType position angle} that will be used by propagator
42 * </p>
43 * @param propagator propagator bound to this harvester
44 * @param stmName State Transition Matrix state name
45 * @param initialStm initial State Transition Matrix ∂C/∂K₀,
46 * if null (which is the most frequent case), assumed to be just the
47 * conversion from Keplerian type to Cartesian type at t₀
48 * @param initialJacobianColumns initial columns of the Jacobians matrix with respect to parameters,
49 * if null or if some selected parameters are missing from the dictionary, the corresponding
50 * initial column is assumed to be 0
51 */
52 TLEHarvester(final TLEPropagator propagator, final String stmName,
53 final RealMatrix initialStm, final DoubleArrayDictionary initialJacobianColumns) {
54 super(propagator);
55 this.propagator = propagator;
56 setInitialStm(stmName, initialStm);
57 setInitialJacobianColumns(initialJacobianColumns);
58 }
59
60 /** {@inheritDoc}
61 * <p>
62 * As the propagated state is Cartesian for TLE propagators, this is the Jacobian of the
63 * Cartesian coordinates with respect to the TLE mean elements representing the state.
64 * </p>
65 */
66 @Override
67 public RealMatrix getStateJacobianVsBuilderParameters(final SpacecraftState state) {
68 return propagator.getTleGenerationAlgorithm().getJacobianWrtParameters(builderParameters(state));
69 }
70
71 /** Get the TLE whose orbital elements are the builder parameters representing a state.
72 * @param state state to represent
73 * @return TLE holding the mean elements that represent the given state
74 */
75 private TLE builderParameters(final SpacecraftState state) {
76
77 final TLE current = propagator.getTLE();
78
79 if (state.getDate().isEqualTo(current.getDate())) {
80 // the TLE held by the propagator already is the exact representation of the
81 // state at its own epoch, so we use it as is rather than rebuilding it, which
82 // would only add the convergence noise of the osculating to mean iterations
83 return current;
84 }
85
86 // rebuild the mean elements matching the state, keeping the identification data
87 // (satellite number, launch data, B*, …) of the TLE held by the propagator
88 // FIXME: not sure about the performance of this one
89 return propagator.getTleGenerationAlgorithm().generate(state, current);
90
91 }
92
93 /** {@inheritDoc} */
94 @Override
95 public AbstractAnalyticalGradientConverter getGradientConverter() {
96 return new TLEGradientConverter(propagator);
97 }
98
99 }