use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class SP3ParserTest method testUnsupportedVersion.
@Test
public void testUnsupportedVersion() throws IOException {
try {
final String ex = "/sp3/unsupported-version.sp3";
final Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
final SP3Parser parser = new SP3Parser(Constants.EIGEN5C_EARTH_MU, 3, s -> frame);
final InputStream inEntry = getClass().getResourceAsStream(ex);
parser.parse(inEntry);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.SP3_UNSUPPORTED_VERSION, oe.getSpecifier());
Assert.assertEquals('z', ((Character) oe.getParts()[0]).charValue());
}
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class EstimationTestUtils method geoStationnaryContext.
public static Context geoStationnaryContext(final String dataRoot) throws OrekitException {
Utils.setDataRoot(dataRoot);
Context context = new Context();
context.conventions = IERSConventions.IERS_2010;
context.utc = TimeScalesFactory.getUTC();
context.ut1 = TimeScalesFactory.getUT1(context.conventions, true);
context.displacements = new StationDisplacement[0];
String Myframename = "MyEarthFrame";
final AbsoluteDate datedef = new AbsoluteDate(2000, 1, 1, 12, 0, 0.0, context.utc);
final double omega = Constants.WGS84_EARTH_ANGULAR_VELOCITY;
final Vector3D rotationRate = new Vector3D(0.0, 0.0, omega);
TransformProvider MyEarthFrame = new TransformProvider() {
private static final long serialVersionUID = 1L;
public Transform getTransform(final AbsoluteDate date) {
final double rotationduration = date.durationFrom(datedef);
final Vector3D alpharot = new Vector3D(rotationduration, rotationRate);
final Rotation rotation = new Rotation(Vector3D.PLUS_K, -alpharot.getZ(), RotationConvention.VECTOR_OPERATOR);
return new Transform(date, rotation, rotationRate);
}
public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {
final T rotationduration = date.durationFrom(datedef);
final FieldVector3D<T> alpharot = new FieldVector3D<>(rotationduration, rotationRate);
final FieldRotation<T> rotation = new FieldRotation<>(FieldVector3D.getPlusK(date.getField()), alpharot.getZ().negate(), RotationConvention.VECTOR_OPERATOR);
return new FieldTransform<>(date, rotation, new FieldVector3D<>(date.getField(), rotationRate));
}
};
Frame FrameTest = new Frame(FramesFactory.getEME2000(), MyEarthFrame, Myframename, true);
// Earth is spherical, rotating in one sidereal day
context.earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0.0, FrameTest);
context.sun = CelestialBodyFactory.getSun();
context.moon = CelestialBodyFactory.getMoon();
context.radiationSensitive = new IsotropicRadiationClassicalConvention(2.0, 0.2, 0.8);
context.dragSensitive = new IsotropicDrag(2.0, 1.2);
GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
AstronomicalAmplitudeReader aaReader = new AstronomicalAmplitudeReader("hf-fes2004.dat", 5, 2, 3, 1.0);
DataProvidersManager.getInstance().feed(aaReader.getSupportedNames(), aaReader);
Map<Integer, Double> map = aaReader.getAstronomicalAmplitudesMap();
GravityFieldFactory.addOceanTidesReader(new FESCHatEpsilonReader("fes2004-7x7.dat", 0.01, FastMath.toRadians(1.0), OceanLoadDeformationCoefficients.IERS_2010, map));
context.gravity = GravityFieldFactory.getNormalizedProvider(20, 20);
// semimajor axis for a geostationnary satellite
double da = FastMath.cbrt(context.gravity.getMu() / (omega * omega));
// context.stations = Arrays.asList(context.createStation( 0.0, 0.0, 0.0, "Lat0_Long0"),
// context.createStation( 62.29639, -7.01250, 880.0, "Slættaratindur")
// );
context.stations = Arrays.asList(context.createStation(0.0, 0.0, 0.0, "Lat0_Long0"));
// Station position & velocity in EME2000
final Vector3D geovelocity = new Vector3D(0., 0., 0.);
// Compute the frames transformation from station frame to EME2000
Transform topoToEME = context.stations.get(0).getBaseFrame().getTransformTo(FramesFactory.getEME2000(), new AbsoluteDate(2000, 1, 1, 12, 0, 0.0, context.utc));
// Station position in EME2000 at reference date
Vector3D stationPositionEME = topoToEME.transformPosition(Vector3D.ZERO);
// Satellite position and velocity in Station Frame
final Vector3D sat_pos = new Vector3D(0., 0., da - stationPositionEME.getNorm());
final Vector3D acceleration = new Vector3D(-context.gravity.getMu(), sat_pos);
final PVCoordinates pv_sat_topo = new PVCoordinates(sat_pos, geovelocity, acceleration);
// satellite position in EME2000
final PVCoordinates pv_sat_iner = topoToEME.transformPVCoordinates(pv_sat_topo);
// Geo-stationary Satellite Orbit, tightly above the station (l0-L0)
context.initialOrbit = new KeplerianOrbit(pv_sat_iner, FramesFactory.getEME2000(), new AbsoluteDate(2000, 1, 1, 12, 0, 0.0, context.utc), context.gravity.getMu());
context.stations = Arrays.asList(context.createStation(10.0, 45.0, 0.0, "Lat10_Long45"));
// Turn-around range stations
// Map entry = master station
// Map value = slave station associated
context.TARstations = new HashMap<GroundStation, GroundStation>();
context.TARstations.put(context.createStation(41.977, 13.600, 671.354, "Fucino"), context.createStation(43.604, 1.444, 263.0, "Toulouse"));
context.TARstations.put(context.createStation(49.867, 8.65, 144.0, "Darmstadt"), context.createStation(-25.885, 27.707, 1566.633, "Pretoria"));
return context;
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class IodGibbsTest method testGibbs1.
@Test
public void testGibbs1() throws OrekitException {
final Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
final double mu = context.initialOrbit.getMu();
final Frame frame = context.initialOrbit.getFrame();
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 PVMeasurementCreator(), 0.0, 1.0, 60.0);
final Vector3D position1 = new Vector3D(measurements.get(0).getObservedValue()[0], measurements.get(0).getObservedValue()[1], measurements.get(0).getObservedValue()[2]);
final PV pv1 = new PV(measurements.get(0).getDate(), position1, Vector3D.ZERO, 0., 0., 1.);
final Vector3D position2 = new Vector3D(measurements.get(1).getObservedValue()[0], measurements.get(1).getObservedValue()[1], measurements.get(1).getObservedValue()[2]);
final PV pv2 = new PV(measurements.get(1).getDate(), position2, Vector3D.ZERO, 0., 0., 1.);
final Vector3D position3 = new Vector3D(measurements.get(2).getObservedValue()[0], measurements.get(2).getObservedValue()[1], measurements.get(2).getObservedValue()[2]);
final PV pv3 = new PV(measurements.get(2).getDate(), position3, Vector3D.ZERO, 0., 0., 1.);
// instantiate the IOD method
final IodGibbs gibbs = new IodGibbs(mu);
final KeplerianOrbit orbit = gibbs.estimate(frame, pv1, pv2, pv3);
Assert.assertEquals(context.initialOrbit.getA(), orbit.getA(), 1.0e-9 * context.initialOrbit.getA());
Assert.assertEquals(context.initialOrbit.getE(), orbit.getE(), 1.0e-9 * context.initialOrbit.getE());
Assert.assertEquals(context.initialOrbit.getI(), orbit.getI(), 1.0e-9 * context.initialOrbit.getI());
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class IodGoodingTest method testGooding.
@Test
public void testGooding() throws OrekitException {
final Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
final double mu = context.initialOrbit.getMu();
final Frame frame = context.initialOrbit.getFrame();
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 PVMeasurementCreator(), 0.0, 1.0, 60.0);
// measurement data 1
final int idMeasure1 = 0;
final AbsoluteDate date1 = measurements.get(idMeasure1).getDate();
final Vector3D stapos1 = Vector3D.ZERO;
/*context.stations.get(0) // FIXME we need to access the station of the measurement
.getBaseFrame()
.getPVCoordinates(date1, frame)
.getPosition();*/
final Vector3D position1 = new Vector3D(measurements.get(idMeasure1).getObservedValue()[0], measurements.get(idMeasure1).getObservedValue()[1], measurements.get(idMeasure1).getObservedValue()[2]);
final double r1 = position1.getNorm();
final Vector3D lineOfSight1 = position1.normalize();
// measurement data 2
final int idMeasure2 = 20;
final AbsoluteDate date2 = measurements.get(idMeasure2).getDate();
final Vector3D stapos2 = Vector3D.ZERO;
/*context.stations.get(0) // FIXME we need to access the station of the measurement
.getBaseFrame()
.getPVCoordinates(date2, frame)
.getPosition();*/
final Vector3D position2 = new Vector3D(measurements.get(idMeasure2).getObservedValue()[0], measurements.get(idMeasure2).getObservedValue()[1], measurements.get(idMeasure2).getObservedValue()[2]);
final Vector3D lineOfSight2 = position2.normalize();
// measurement data 3
final int idMeasure3 = 40;
final AbsoluteDate date3 = measurements.get(idMeasure3).getDate();
final Vector3D stapos3 = Vector3D.ZERO;
/*context.stations.get(0) // FIXME we need to access the station of the measurement
.getBaseFrame()
.getPVCoordinates(date3, frame)
.getPosition();*/
final Vector3D position3 = new Vector3D(measurements.get(idMeasure3).getObservedValue()[0], measurements.get(idMeasure3).getObservedValue()[1], measurements.get(idMeasure3).getObservedValue()[2]);
final double r3 = position3.getNorm();
final Vector3D lineOfSight3 = position3.normalize();
// instantiate the IOD method
final IodGooding iod = new IodGooding(frame, mu);
// the problem is very sensitive, and unless one can provide the exact
// initial range estimate, the estimate may be far off the truth...
final KeplerianOrbit orbit = iod.estimate(stapos1, stapos2, stapos3, lineOfSight1, date1, lineOfSight2, date2, lineOfSight3, date3, r1 * 1.0, r3 * 1.0);
Assert.assertEquals(orbit.getA(), context.initialOrbit.getA(), 1.0e-6 * context.initialOrbit.getA());
Assert.assertEquals(orbit.getE(), context.initialOrbit.getE(), 1.0e-6 * context.initialOrbit.getE());
Assert.assertEquals(orbit.getI(), context.initialOrbit.getI(), 1.0e-6 * context.initialOrbit.getI());
Assert.assertEquals(13127847.99808, iod.getRange1(), 1.0e-3);
Assert.assertEquals(13375711.51931, iod.getRange2(), 1.0e-3);
Assert.assertEquals(13950296.64852, iod.getRange3(), 1.0e-3);
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class JB2008 method getDensity.
/**
* {@inheritDoc}
*/
@Override
public <T extends RealFieldElement<T>> T getDensity(final FieldAbsoluteDate<T> date, final FieldVector3D<T> position, final Frame frame) throws OrekitException {
// check if data are available :
final AbsoluteDate dateD = date.toAbsoluteDate();
if ((dateD.compareTo(inputParams.getMaxDate()) > 0) || (dateD.compareTo(inputParams.getMinDate()) < 0)) {
throw new OrekitException(OrekitMessages.NO_SOLAR_ACTIVITY_AT_DATE, dateD, inputParams.getMinDate(), inputParams.getMaxDate());
}
// compute MJD date
final T dateMJD = date.durationFrom(AbsoluteDate.MODIFIED_JULIAN_EPOCH).divide(Constants.JULIAN_DAY);
// compute geodetic position (km and °)
final FieldGeodeticPoint<T> inBody = earth.transform(position, frame, date);
// compute sun position
final Frame ecef = earth.getBodyFrame();
final FieldVector3D<T> sunPos = new FieldVector3D<>(date.getField(), sun.getPVCoordinates(dateD, ecef).getPosition());
final FieldGeodeticPoint<T> sunInBody = earth.transform(sunPos, ecef, date);
return getDensity(dateMJD, sunInBody.getLongitude(), sunInBody.getLatitude(), inBody.getLongitude(), inBody.getLatitude(), inBody.getAltitude(), inputParams.getF10(dateD), inputParams.getF10B(dateD), inputParams.getS10(dateD), inputParams.getS10B(dateD), inputParams.getXM10(dateD), inputParams.getXM10B(dateD), inputParams.getY10(dateD), inputParams.getY10B(dateD), inputParams.getDSTDTC(dateD));
}
Aggregations