1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.orekit.estimation.iod;
19
20 import org.hipparchus.geometry.euclidean.threed.Vector3D;
21 import org.hipparchus.util.FastMath;
22 import org.junit.jupiter.api.BeforeEach;
23 import org.orekit.Utils;
24 import org.orekit.bodies.GeodeticPoint;
25 import org.orekit.bodies.OneAxisEllipsoid;
26 import org.orekit.estimation.measurements.AngularAzEl;
27 import org.orekit.estimation.measurements.AngularRaDec;
28 import org.orekit.estimation.measurements.EstimatedMeasurementBase;
29 import org.orekit.estimation.measurements.GroundStation;
30 import org.orekit.estimation.measurements.ObservableSatellite;
31 import org.orekit.frames.Frame;
32 import org.orekit.frames.FramesFactory;
33 import org.orekit.frames.TopocentricFrame;
34 import org.orekit.orbits.Orbit;
35 import org.orekit.propagation.Propagator;
36 import org.orekit.propagation.SpacecraftState;
37 import org.orekit.time.AbsoluteDate;
38 import org.orekit.utils.AbsolutePVCoordinates;
39 import org.orekit.utils.Constants;
40 import org.orekit.utils.IERSConventions;
41 import org.orekit.utils.PVCoordinatesProvider;
42 import org.orekit.utils.TimeStampedPVCoordinates;
43
44 public abstract class AbstractIodTest {
45
46
47
48 protected Frame gcrf;
49
50
51
52
53 protected Frame eme2000;
54
55
56
57
58 protected GroundStation observer;
59
60
61
62
63 protected double mu;
64
65
66
67
68 protected Frame itrf;
69
70 @BeforeEach
71 public void setUp() {
72 Utils.setDataRoot("regular-data");
73
74 this.mu = Constants.WGS84_EARTH_MU;
75 this.gcrf = FramesFactory.getGCRF();
76 this.eme2000 = FramesFactory.getEME2000();
77
78 this.itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, false);
79
80 final OneAxisEllipsoid body = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
81 Constants.WGS84_EARTH_FLATTENING, itrf);
82 this.observer = new GroundStation(new TopocentricFrame(body,
83 new GeodeticPoint(FastMath.toRadians(40),
84 FastMath.toRadians(-110),
85 2000.0), ""));
86 this.observer.getPrimeMeridianOffsetDriver().setReferenceDate(AbsoluteDate.J2000_EPOCH);
87 this.observer.getPolarOffsetXDriver().setReferenceDate(AbsoluteDate.J2000_EPOCH);
88 this.observer.getPolarOffsetYDriver().setReferenceDate(AbsoluteDate.J2000_EPOCH);
89
90 }
91
92
93 protected Vector3D getLOSAngles(final Propagator prop, final AbsoluteDate date) {
94 final AngularRaDec raDec = new AngularRaDec(observer, gcrf, date, new double[] { 0.0, 0.0 },
95 new double[] { 1.0, 1.0 },
96 new double[] { 1.0, 1.0 }, new ObservableSatellite(0));
97 return (getEstimatedLineOfSight(raDec, prop, date, gcrf));
98 }
99
100 protected AngularAzEl getAzEl(final Propagator prop, final AbsoluteDate date) {
101 ObservableSatellite satellite = new ObservableSatellite(0);
102 final AngularAzEl azEl = new AngularAzEl(observer, date, new double[] { 0.0, 0.0 },
103 new double[] { 1.0, 1.0 }, new double[] { 1.0, 1.0 },
104 satellite);
105 EstimatedMeasurementBase<AngularAzEl> estimated = azEl.estimateWithoutDerivatives(new SpacecraftState[] {prop.propagate(date)});
106 return new AngularAzEl(observer, date, estimated.getEstimatedValue(), azEl.getBaseWeight(),
107 azEl.getTheoreticalStandardDeviation(), satellite);
108 }
109
110 protected double getRelativeRangeError(final Orbit estimatedGauss, final Orbit orbitRef) {
111
112 return FastMath.abs(estimatedGauss.getPVCoordinates().getPosition().getNorm() -
113 orbitRef.getPVCoordinates().getPosition().getNorm()) /
114 FastMath.abs(orbitRef.getPVCoordinates().getPosition().getNorm());
115 }
116
117
118 protected double getRelativeVelocityError(final Orbit estimatedGauss, final Orbit orbitRef) {
119
120 return FastMath.abs(estimatedGauss.getPVCoordinates().getVelocity().getNorm() -
121 orbitRef.getPVCoordinates().getVelocity().getNorm()) /
122 FastMath.abs(orbitRef.getPVCoordinates().getVelocity().getNorm());
123 }
124
125
126
127
128
129
130
131
132 private Vector3D getEstimatedLineOfSight(final AngularRaDec raDec, final PVCoordinatesProvider pvProvider, final AbsoluteDate date, final Frame outputFrame) {
133 final TimeStampedPVCoordinates satPV = pvProvider.getPVCoordinates(date, outputFrame);
134 final AbsolutePVCoordinates satPVInGCRF = new AbsolutePVCoordinates(outputFrame, satPV);
135 final SpacecraftState[] satState = new SpacecraftState[] { new SpacecraftState(satPVInGCRF) };
136 final double[] angular = raDec.estimateWithoutDerivatives(satState).getEstimatedValue();
137
138
139 return raDec.getReferenceFrame().getStaticTransformTo(outputFrame, date)
140 .transformVector(new Vector3D(angular[0], angular[1]));
141 }
142 }