use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class HarrisPriesterTest method testParameterN.
@Test
public void testParameterN() throws OrekitException {
final HarrisPriester hp = new HarrisPriester(sun, earth);
// Position at 500 km height
final GeodeticPoint point = new GeodeticPoint(0, 0, 500000.);
final Vector3D pos = earth.transform(point);
// COMPUTE DENSITY KG/M3 RHO
final double rho4 = hp.getDensity(date, pos, earthFrame);
final HarrisPriester hp2 = new HarrisPriester(sun, earth, 2);
// COMPUTE DENSITY KG/M3 RHO
final double rho2 = hp2.getDensity(date, pos, earthFrame);
final HarrisPriester hp6 = new HarrisPriester(sun, earth, 6);
// COMPUTE DENSITY KG/M3 RHO
final double rho6 = hp6.getDensity(date, pos, earthFrame);
final double c2Psi2 = 0.02163787;
Assert.assertEquals(c2Psi2, (rho6 - rho2) / (rho4 - rho2) - 1., 1.e-8);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class HarrisPriesterTest method testOutOfRange.
@Test(expected = OrekitException.class)
public void testOutOfRange() throws OrekitException {
final HarrisPriester hp = new HarrisPriester(sun, earth);
// Position at 50 km height
final GeodeticPoint point = new GeodeticPoint(0, 0, 50000.);
final Vector3D pos = earth.transform(point);
// COMPUTE DENSITY KG/M3 RHO
hp.getDensity(date, pos, earthFrame);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class HarrisPriesterTest method testMaxAlt.
@Test
public void testMaxAlt() throws OrekitException {
final HarrisPriester hp = new HarrisPriester(sun, earth);
// Position at 1500 km height
final GeodeticPoint point = new GeodeticPoint(0, 0, 1500000.);
final Vector3D pos = earth.transform(point);
// COMPUTE DENSITY KG/M3 RHO
final double rho = hp.getDensity(date, pos, earthFrame);
Assert.assertEquals(0.0, rho, 0.0);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class NRLMSISE00Test method testDensity.
@Test
public void testDensity() throws OrekitException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
// Build the input params provider
final InputParams ip = new InputParams();
// Get Sun
final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
// Get Earth body shape
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
// Build the model
final NRLMSISE00 atm = new NRLMSISE00(ip, sun, earth).withSwitch(9, -1);
// Build the date
final AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 172), new TimeComponents(29000.), TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true));
// Build the position
final double alt = 400.;
final double lat = 60.;
final double lon = -70.;
final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(lat), FastMath.toRadians(lon), alt * 1000.);
final Vector3D pos = earth.transform(point);
// Run
final double rho = atm.getDensity(date, pos, itrf);
final double lst = 29000. / 3600. - 70. / 15.;
final double[] ap = { 4., 100., 100., 100., 100., 100., 100. };
Class<?> outputClass = getOutputClass();
Constructor<?> cons = outputClass.getDeclaredConstructor(NRLMSISE00.class, Integer.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE, double[].class);
cons.setAccessible(true);
Method gtd7d = outputClass.getDeclaredMethod("gtd7d", Double.TYPE);
gtd7d.setAccessible(true);
Method getDensity = outputClass.getDeclaredMethod("getDensity", Integer.TYPE);
getDensity.setAccessible(true);
final Object out = createOutput(atm, 172, 29000., 60., -70, lst, 150., 150., ap);
gtd7d.invoke(out, 400.0);
Assert.assertEquals(rho, ((Double) getDensity.invoke(out, 5)).doubleValue(), rho * 1.e-3);
}
use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.
the class GroundStationTest method testEstimateStationPosition.
@Test
public void testEstimateStationPosition() throws OrekitException, IOException, ClassNotFoundException {
Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 0.001);
// create perfect range measurements
final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeMeasurementCreator(context), 1.0, 3.0, 300.0);
// move one station
final RandomGenerator random = new Well19937a(0x4adbecfc743bda60l);
final TopocentricFrame base = context.stations.get(0).getBaseFrame();
final BodyShape parent = base.getParentShape();
final Vector3D baseOrigin = parent.transform(base.getPoint());
final Vector3D deltaTopo = new Vector3D(2 * random.nextDouble() - 1, 2 * random.nextDouble() - 1, 2 * random.nextDouble() - 1);
final Transform topoToParent = base.getTransformTo(parent.getBodyFrame(), (AbsoluteDate) null);
final Vector3D deltaParent = topoToParent.transformVector(deltaTopo);
final String movedSuffix = "-moved";
final GroundStation moved = new GroundStation(new TopocentricFrame(parent, parent.transform(baseOrigin.subtract(deltaParent), parent.getBodyFrame(), null), base.getName() + movedSuffix), context.ut1.getEOPHistory(), context.stations.get(0).getDisplacements());
// create orbit estimator
final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder);
for (final ObservedMeasurement<?> measurement : measurements) {
final Range range = (Range) measurement;
final String name = range.getStation().getBaseFrame().getName() + movedSuffix;
if (moved.getBaseFrame().getName().equals(name)) {
estimator.addMeasurement(new Range(moved, range.getDate(), range.getObservedValue()[0], range.getTheoreticalStandardDeviation()[0], range.getBaseWeight()[0]));
} else {
estimator.addMeasurement(range);
}
}
estimator.setParametersConvergenceThreshold(1.0e-3);
estimator.setMaxIterations(100);
estimator.setMaxEvaluations(200);
// we want to estimate station offsets
moved.getEastOffsetDriver().setSelected(true);
moved.getNorthOffsetDriver().setSelected(true);
moved.getZenithOffsetDriver().setSelected(true);
EstimationTestUtils.checkFit(context, estimator, 2, 3, 0.0, 5.6e-7, 0.0, 1.4e-6, 0.0, 4.8e-7, 0.0, 2.6e-10);
Assert.assertEquals(deltaTopo.getX(), moved.getEastOffsetDriver().getValue(), 4.5e-7);
Assert.assertEquals(deltaTopo.getY(), moved.getNorthOffsetDriver().getValue(), 6.2e-7);
Assert.assertEquals(deltaTopo.getZ(), moved.getZenithOffsetDriver().getValue(), 2.6e-7);
GeodeticPoint result = moved.getOffsetGeodeticPoint(null);
GeodeticPoint reference = context.stations.get(0).getBaseFrame().getPoint();
Assert.assertEquals(reference.getLatitude(), result.getLatitude(), 1.4e-14);
Assert.assertEquals(reference.getLongitude(), result.getLongitude(), 2.9e-14);
Assert.assertEquals(reference.getAltitude(), result.getAltitude(), 2.6e-7);
RealMatrix normalizedCovariances = estimator.getOptimum().getCovariances(1.0e-10);
RealMatrix physicalCovariances = estimator.getPhysicalCovariances(1.0e-10);
Assert.assertEquals(9, normalizedCovariances.getRowDimension());
Assert.assertEquals(9, normalizedCovariances.getColumnDimension());
Assert.assertEquals(9, physicalCovariances.getRowDimension());
Assert.assertEquals(9, physicalCovariances.getColumnDimension());
Assert.assertEquals(0.55431, physicalCovariances.getEntry(6, 6), 1.0e-5);
Assert.assertEquals(0.22694, physicalCovariances.getEntry(7, 7), 1.0e-5);
Assert.assertEquals(0.13106, physicalCovariances.getEntry(8, 8), 1.0e-5);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(moved.getEstimatedEarthFrame().getTransformProvider());
Assert.assertTrue(bos.size() > 155000);
Assert.assertTrue(bos.size() < 160000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
EstimatedEarthFrameProvider deserialized = (EstimatedEarthFrameProvider) ois.readObject();
Assert.assertEquals(moved.getPrimeMeridianOffsetDriver().getValue(), deserialized.getPrimeMeridianOffsetDriver().getValue(), 1.0e-15);
Assert.assertEquals(moved.getPrimeMeridianDriftDriver().getValue(), deserialized.getPrimeMeridianDriftDriver().getValue(), 1.0e-15);
Assert.assertEquals(moved.getPolarOffsetXDriver().getValue(), deserialized.getPolarOffsetXDriver().getValue(), 1.0e-15);
Assert.assertEquals(moved.getPolarDriftXDriver().getValue(), deserialized.getPolarDriftXDriver().getValue(), 1.0e-15);
Assert.assertEquals(moved.getPolarOffsetYDriver().getValue(), deserialized.getPolarOffsetYDriver().getValue(), 1.0e-15);
Assert.assertEquals(moved.getPolarDriftYDriver().getValue(), deserialized.getPolarDriftYDriver().getValue(), 1.0e-15);
}
Aggregations