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 java.util.Arrays;
20  import java.util.List;
21  
22  import org.hipparchus.util.FastMath;
23  import org.orekit.bodies.CelestialBody;
24  import org.orekit.bodies.CelestialBodyFactory;
25  import org.orekit.bodies.GeodeticPoint;
26  import org.orekit.bodies.OneAxisEllipsoid;
27  import org.orekit.estimation.measurements.GroundStation;
28  import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
29  import org.orekit.frames.EOPHistory;
30  import org.orekit.frames.FramesFactory;
31  import org.orekit.frames.TopocentricFrame;
32  import org.orekit.models.earth.displacement.StationDisplacement;
33  import org.orekit.models.earth.displacement.TidalDisplacement;
34  import org.orekit.orbits.Orbit;
35  import org.orekit.time.TimeScale;
36  import org.orekit.time.TimeScalesFactory;
37  import org.orekit.time.UT1Scale;
38  import org.orekit.utils.Constants;
39  import org.orekit.utils.IERSConventions;
40  
41  public class EphemerisContext implements StationDataProvider {
42  
43      public IERSConventions                        conventions;
44      public OneAxisEllipsoid                       earth;
45      public CelestialBody                          sun;
46      public CelestialBody                          moon;
47      public UnnormalizedSphericalHarmonicsProvider gravity;
48      public TimeScale                              utc;
49      public UT1Scale                               ut1;
50      public Orbit                                  initialOrbit;
51      public StationDisplacement[]                  displacements;
52      public List<GroundStation>                    stations;
53  
54      public EphemerisContext() {
55          this.conventions = IERSConventions.IERS_2010;
56          this.earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
57                                            Constants.WGS84_EARTH_FLATTENING,
58                                            FramesFactory.getITRF(conventions, true));
59          final EOPHistory eopHistory = FramesFactory.getEOPHistory(conventions, true);
60          this.ut1 = TimeScalesFactory.getUT1(eopHistory);
61          this.displacements = new StationDisplacement[] {
62                  new TidalDisplacement(Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS,
63                                        Constants.JPL_SSD_SUN_EARTH_PLUS_MOON_MASS_RATIO,
64                                        Constants.JPL_SSD_EARTH_MOON_MASS_RATIO,
65                                        CelestialBodyFactory.getSun(), CelestialBodyFactory.getMoon(),
66                                        conventions, false)
67                  };
68          this.stations = Arrays.asList(createStation(-53.05388,  -75.01551, 1750.0, "Isla Desolación"),
69                                        createStation( 62.29639,   -7.01250,  880.0, "Slættaratindur"));
70  
71  	}
72  
73      GroundStation createStation(double latitudeInDegrees, double longitudeInDegrees,
74                                  double altitude, String name) {
75          final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(latitudeInDegrees),
76                                                     FastMath.toRadians(longitudeInDegrees),
77                                                     altitude);
78          return new GroundStation(new TopocentricFrame(earth, gp, name), ut1.getEOPHistory(), displacements);
79      }
80  
81      @Override
82      public List<GroundStation> getStations() {
83          return stations;
84      }
85  
86  }