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.estimation;
18  
19  import org.hipparchus.util.FastMath;
20  import org.orekit.bodies.CelestialBody;
21  import org.orekit.bodies.GeodeticPoint;
22  import org.orekit.bodies.OneAxisEllipsoid;
23  import org.orekit.estimation.measurements.GroundStation;
24  import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
25  import org.orekit.frames.TopocentricFrame;
26  import org.orekit.models.earth.displacement.StationDisplacement;
27  import org.orekit.orbits.PositionAngleType;
28  import org.orekit.propagation.analytical.tle.TLE;
29  import org.orekit.propagation.analytical.tle.generation.FixedPointTleGenerationAlgorithm;
30  import org.orekit.propagation.conversion.TLEPropagatorBuilder;
31  import org.orekit.time.TimeScale;
32  import org.orekit.time.UT1Scale;
33  import org.orekit.utils.IERSConventions;
34  
35  import java.util.List;
36  import java.util.Map;
37  
38  public class TLEContext implements StationDataProvider {
39      public IERSConventions                      conventions;
40      public OneAxisEllipsoid                     earth;
41      public CelestialBody                        sun;
42      public CelestialBody                        moon;
43      public NormalizedSphericalHarmonicsProvider gravity;
44      public TimeScale                            utc;
45      public UT1Scale                             ut1;
46      public TLE                                  initialTLE;
47      public StationDisplacement[]                displacements;
48      public List<GroundStation>                  stations;
49      // Stations for turn-around range
50      // Map entry = primary station
51      // Map value = secondary station associated
52      public Map<GroundStation, GroundStation>     TARstations;
53  
54      public TLEPropagatorBuilder createBuilder(final double dP) {
55          return new TLEPropagatorBuilder(initialTLE, PositionAngleType.MEAN, dP,
56                                          new FixedPointTleGenerationAlgorithm());
57      }
58  
59      GroundStation createStation(double latitudeInDegrees, double longitudeInDegrees,
60                                  double altitude, String name) {
61          final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(latitudeInDegrees),
62                                                     FastMath.toRadians(longitudeInDegrees),
63                                                     altitude);
64          return new GroundStation(new TopocentricFrame(earth, gp, name), ut1.getEOPHistory(), displacements);
65      }
66  
67      @Override
68      public List<GroundStation> getStations() {
69          return stations;
70      }
71  
72  }