1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.estimation;
18
19 import java.util.List;
20 import java.util.Map;
21
22 import org.hipparchus.geometry.euclidean.threed.Vector3D;
23 import org.hipparchus.util.FastMath;
24 import org.hipparchus.util.Pair;
25 import org.orekit.bodies.CelestialBody;
26 import org.orekit.bodies.GeodeticPoint;
27 import org.orekit.bodies.OneAxisEllipsoid;
28 import org.orekit.estimation.measurements.GroundStation;
29 import org.orekit.forces.drag.DragSensitive;
30 import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
31 import org.orekit.forces.radiation.RadiationSensitive;
32 import org.orekit.frames.TopocentricFrame;
33 import org.orekit.models.earth.displacement.StationDisplacement;
34 import org.orekit.orbits.CartesianOrbit;
35 import org.orekit.orbits.Orbit;
36 import org.orekit.orbits.OrbitType;
37 import org.orekit.orbits.PositionAngle;
38 import org.orekit.propagation.conversion.DormandPrince853IntegratorBuilder;
39 import org.orekit.propagation.conversion.NumericalPropagatorBuilder;
40 import org.orekit.time.TimeScale;
41 import org.orekit.time.UT1Scale;
42 import org.orekit.utils.IERSConventions;
43 import org.orekit.utils.PVCoordinates;
44
45 public class Context implements StationDataProvider {
46 public IERSConventions conventions;
47 public OneAxisEllipsoid earth;
48 public CelestialBody sun;
49 public CelestialBody moon;
50 public RadiationSensitive radiationSensitive;
51 public DragSensitive dragSensitive;
52 public NormalizedSphericalHarmonicsProvider gravity;
53 public TimeScale utc;
54 public UT1Scale ut1;
55 public Orbit initialOrbit;
56 public StationDisplacement[] displacements;
57 public List<GroundStation> stations;
58
59
60
61 public Map<GroundStation, GroundStation> TARstations;
62
63
64
65 public Pair<GroundStation, GroundStation> BRRstations;
66
67
68
69 public Pair<GroundStation, GroundStation> TDOAstations;
70
71 public NumericalPropagatorBuilder createBuilder(final OrbitType orbitType, final PositionAngle positionAngle,
72 final boolean perfectStart,
73 final double minStep, final double maxStep, final double dP,
74 final Force... forces) {
75
76 final Orbit startOrbit;
77 if (perfectStart) {
78
79 startOrbit = initialOrbit;
80 } else {
81
82 final Vector3D initialPosition = initialOrbit.getPVCoordinates().getPosition();
83 final Vector3D initialVelocity = initialOrbit.getPVCoordinates().getVelocity();
84 final Vector3D wrongPosition = initialPosition.add(new Vector3D(1000.0, 0, 0));
85 final Vector3D wrongVelocity = initialVelocity.add(new Vector3D(0, 0, 0.01));
86 startOrbit = new CartesianOrbit(new PVCoordinates(wrongPosition, wrongVelocity),
87 initialOrbit.getFrame(),
88 initialOrbit.getDate(),
89 initialOrbit.getMu());
90 }
91 final NumericalPropagatorBuilder propagatorBuilder =
92 new NumericalPropagatorBuilder(orbitType.convertType(startOrbit),
93 new DormandPrince853IntegratorBuilder(minStep, maxStep, dP),
94 positionAngle, dP);
95 for (Force force : forces) {
96 propagatorBuilder.addForceModel(force.getForceModel(this));
97 }
98
99 return propagatorBuilder;
100
101 }
102
103 GroundStation createStation(double latitudeInDegrees, double longitudeInDegrees,
104 double altitude, String name) {
105 final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(latitudeInDegrees),
106 FastMath.toRadians(longitudeInDegrees),
107 altitude);
108 return new GroundStation(new TopocentricFrame(earth, gp, name),
109 ut1.getEOPHistory(), displacements);
110 }
111
112 @Override
113 public List<GroundStation> getStations() {
114 return stations;
115 }
116
117 }