use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class TLETest method testDirectConstruction.
@Test
public void testDirectConstruction() throws OrekitException {
TLE tleA = new TLE(5555, 'U', 1971, 86, "J", 0, 908, new AbsoluteDate(new DateComponents(2012, 26), new TimeComponents(0.96078249 * Constants.JULIAN_DAY), TimeScalesFactory.getUTC()), taylorConvert(12.26882470, 1), taylorConvert(-0.00000004, 2), taylorConvert(0.00001e-9, 3), 0.0075476, FastMath.toRadians(74.0161), FastMath.toRadians(328.9888), FastMath.toRadians(228.9750), FastMath.toRadians(30.6709), 80454, 0.01234e-9);
TLE tleB = new TLE("1 05555U 71086J 12026.96078249 -.00000004 00001-9 01234-9 0 9082", "2 05555 74.0161 228.9750 0075476 328.9888 30.6709 12.26882470804545");
Assert.assertEquals(tleA.getSatelliteNumber(), tleB.getSatelliteNumber(), 0);
Assert.assertEquals(tleA.getLaunchYear(), tleB.getLaunchYear());
Assert.assertEquals(tleA.getLaunchNumber(), tleB.getLaunchNumber());
Assert.assertEquals(tleA.getLaunchPiece(), tleB.getLaunchPiece());
Assert.assertEquals(tleA.getBStar(), tleB.getBStar(), 0);
Assert.assertEquals(tleA.getEphemerisType(), tleB.getEphemerisType());
Assert.assertEquals(tleA.getI(), tleB.getI(), 1e-10);
Assert.assertEquals(tleA.getRaan(), tleB.getRaan(), 1e-10);
Assert.assertEquals(tleA.getE(), tleB.getE(), 1e-10);
Assert.assertEquals(tleA.getPerigeeArgument(), tleB.getPerigeeArgument(), 1e-10);
Assert.assertEquals(tleA.getMeanAnomaly(), tleB.getMeanAnomaly(), 1e-10);
Assert.assertEquals(tleA.getMeanMotion(), tleB.getMeanMotion(), 0);
Assert.assertEquals(tleA.getRevolutionNumberAtEpoch(), tleB.getRevolutionNumberAtEpoch(), 0);
Assert.assertEquals(tleA.getElementNumber(), tleB.getElementNumber(), 0);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class CircularFieldOfViewDetectorTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
// Computation date
// Satellite position as circular parameters
mu = 3.9860047e14;
initDate = new AbsoluteDate(new DateComponents(1969, 8, 28), TimeComponents.H00, TimeScalesFactory.getUTC());
Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6);
Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
initialOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
// WGS84 Earth model
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Create earth center pointing attitude provider
earthCenterAttitudeLaw = new BodyCenterPointing(initialOrbit.getFrame(), earth);
} catch (OrekitException oe) {
Assert.fail(oe.getMessage());
}
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class LofOffsetPointingTest method testTypesField.
@Test
public void testTypesField() throws OrekitException {
AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
for (final LOFType type : LOFType.values()) {
RotationOrder order = RotationOrder.ZXY;
double alpha1 = 0.123;
double alpha2 = 0.456;
double alpha3 = 0.789;
LofOffset law = new LofOffset(orbit.getFrame(), type, order, alpha1, alpha2, alpha3);
final Vector3D dir;
switch(type) {
case TNW:
dir = Vector3D.PLUS_J;
break;
case QSW:
case LVLH:
dir = Vector3D.MINUS_I;
break;
case VVLH:
dir = Vector3D.PLUS_K;
break;
default:
// VNC
dir = Vector3D.MINUS_K;
}
LofOffsetPointing lop = new LofOffsetPointing(orbit.getFrame(), earthSpheric, law, dir);
checkField(Decimal64Field.getInstance(), lop, orbit, date, orbit.getFrame());
}
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class NadirPointingTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
// Computation date
date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
// Body mu
mu = 3.9860047e14;
// Reference frame = ITRF
itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
} catch (OrekitException oe) {
Assert.fail(oe.getMessage());
}
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class BodyCenterPointingTest method doTestSpin.
private <T extends RealFieldElement<T>> void doTestSpin(final Field<T> field) throws OrekitException {
final double ehMu = 3.9860047e14;
final double ae = 6.378137e6;
final double c20 = -1.08263e-3;
final double c30 = 2.54e-6;
final double c40 = 1.62e-6;
final double c50 = 2.3e-7;
final double c60 = -5.5e-7;
// Satellite position as circular parameters
final T zero = field.getZero();
final T a = zero.add(7178000.0);
final T e = zero.add(7e-5);
final T i = zero.add(FastMath.toRadians(50.));
final T pa = zero.add(FastMath.toRadians(45.));
final T raan = zero.add(FastMath.toRadians(270.));
final T m = zero.add(FastMath.toRadians(5.3 - 270));
// Computation date
FieldAbsoluteDate<T> date_R = new FieldAbsoluteDate<>(field, new DateComponents(2008, 04, 07), TimeComponents.H00, TimeScalesFactory.getUTC());
// Orbit
FieldKeplerianOrbit<T> circ = new FieldKeplerianOrbit<>(a, e, i, pa, raan, m, PositionAngle.MEAN, FramesFactory.getEME2000(), date_R, ehMu);
// WGS84 Earth model
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Earth center pointing attitude provider
BodyCenterPointing earthCenterAttitudeLaw = new BodyCenterPointing(circ.getFrame(), earth);
final FieldAbsoluteDate<T> date = FieldAbsoluteDate.getJ2000Epoch(field).shiftedBy(584.);
final FieldVector3D<T> position = new FieldVector3D<>(zero.add(3220103.), zero.add(69623.), zero.add(6449822.));
final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(6414.7), zero.add(-2006.), zero.add(-3180.));
final FieldCircularOrbit<T> initialOrbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, ehMu);
FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(initialOrbit, ae, ehMu, c20, c30, c40, c50, c60);
propagator.setAttitudeProvider(earthCenterAttitudeLaw);
double h = 0.01;
FieldSpacecraftState<T> s0 = propagator.propagate(date);
FieldSpacecraftState<T> sMinus = propagator.propagate(date.shiftedBy(-h));
FieldSpacecraftState<T> sPlus = propagator.propagate(date.shiftedBy(h));
// check spin is consistent with attitude evolution
T errorAngleMinus = FieldRotation.distance(sMinus.shiftedBy(zero.add(h)).getAttitude().getRotation(), s0.getAttitude().getRotation());
T evolutionAngleMinus = FieldRotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAngleMinus.getReal(), 1.0e-6 * evolutionAngleMinus.getReal());
T errorAnglePlus = FieldRotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(zero.add(-h)).getAttitude().getRotation());
T evolutionAnglePlus = FieldRotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAnglePlus.getReal(), 1.0e-6 * evolutionAnglePlus.getReal());
FieldVector3D<T> spin0 = s0.getAttitude().getSpin();
FieldVector3D<T> reference = FieldAngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
Assert.assertTrue(spin0.getNorm().getReal() > 1.0e-3);
Assert.assertEquals(0.0, spin0.subtract(reference).getNorm().getReal(), 1.0e-13);
}
Aggregations