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