1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.orekit.estimation;
19
20 import org.hipparchus.geometry.euclidean.threed.Vector3D;
21 import org.hipparchus.util.FastMath;
22 import org.orekit.bodies.CelestialBody;
23 import org.orekit.bodies.GeodeticPoint;
24 import org.orekit.bodies.OneAxisEllipsoid;
25 import org.orekit.estimation.measurements.GroundStation;
26 import org.orekit.frames.TopocentricFrame;
27 import org.orekit.models.earth.displacement.StationDisplacement;
28 import org.orekit.orbits.CartesianOrbit;
29 import org.orekit.orbits.Orbit;
30 import org.orekit.orbits.PositionAngleType;
31 import org.orekit.propagation.conversion.KeplerianPropagatorBuilder;
32 import org.orekit.time.TimeScale;
33 import org.orekit.time.UT1Scale;
34 import org.orekit.utils.IERSConventions;
35 import org.orekit.utils.PVCoordinates;
36
37 import java.util.List;
38
39 public class KeplerianContext implements StationDataProvider {
40
41 public IERSConventions conventions;
42 public OneAxisEllipsoid earth;
43 public CelestialBody sun;
44 public CelestialBody moon;
45 public TimeScale utc;
46 public UT1Scale ut1;
47 public Orbit initialOrbit;
48 public StationDisplacement[] displacements;
49 public List<GroundStation> stations;
50
51 public KeplerianPropagatorBuilder createBuilder(final PositionAngleType angleType, final boolean perfectStart, final double dP) {
52
53 final Orbit startOrbit;
54 if (perfectStart) {
55
56 startOrbit = initialOrbit;
57 } else {
58
59 final Vector3D initialPosition = initialOrbit.getPosition();
60 final Vector3D initialVelocity = initialOrbit.getPVCoordinates().getVelocity();
61 final Vector3D wrongPosition = initialPosition.add(new Vector3D(1000.0, 0, 0));
62 final Vector3D wrongVelocity = initialVelocity.add(new Vector3D(0, 0, 0.01));
63 startOrbit = new CartesianOrbit(new PVCoordinates(wrongPosition, wrongVelocity),
64 initialOrbit.getFrame(),
65 initialOrbit.getDate(),
66 initialOrbit.getMu());
67 }
68
69
70 return new KeplerianPropagatorBuilder(startOrbit, angleType, dP);
71
72 }
73
74 GroundStation createStation(double latitudeInDegrees, double longitudeInDegrees,
75 double altitude, String name) {
76 final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(latitudeInDegrees),
77 FastMath.toRadians(longitudeInDegrees),
78 altitude);
79 return new GroundStation(new TopocentricFrame(earth, gp, name), ut1.getEOPHistory(), displacements);
80 }
81
82 @Override
83 public List<GroundStation> getStations() {
84 return stations;
85 }
86
87 }