use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class OnBoardAntennaInterSatellitesRangeModifier method modifyTwoWay.
/**
* Apply a modifier to an estimated measurement in the two-way case.
* @param estimated estimated measurement to modify
*/
private void modifyTwoWay(final EstimatedMeasurement<InterSatellitesRange> estimated) {
// the participants are satellite 1 at emission, satellite 2 at transit, satellite 1 at reception
final TimeStampedPVCoordinates[] participants = estimated.getParticipants();
final AbsoluteDate emissionDate = participants[0].getDate();
final AbsoluteDate transitDate = participants[1].getDate();
final AbsoluteDate receptionDate = participants[2].getDate();
// transforms from spacecraft to inertial frame at emission/reception dates
final SpacecraftState refState1 = estimated.getStates()[0];
final SpacecraftState receptionState = refState1.shiftedBy(receptionDate.durationFrom(refState1.getDate()));
final Transform receptionSpacecraftToInert = receptionState.toTransform().getInverse();
final SpacecraftState refState2 = estimated.getStates()[1];
final SpacecraftState transitState = refState2.shiftedBy(transitDate.durationFrom(refState2.getDate()));
final Transform transitSpacecraftToInert = transitState.toTransform().getInverse();
final SpacecraftState emissionState = refState1.shiftedBy(emissionDate.durationFrom(refState1.getDate()));
final Transform emissionSpacecraftToInert = emissionState.toTransform().getInverse();
// compute the geometrical value of the inter-satellites range directly from participants positions.
// Note that this may be different from the value returned by estimated.getEstimatedValue(),
// because other modifiers may already have been taken into account
final Vector3D pSpacecraftReception = receptionSpacecraftToInert.transformPosition(Vector3D.ZERO);
final Vector3D pSpacecraftTransit = transitSpacecraftToInert.transformPosition(Vector3D.ZERO);
final Vector3D pSpacecraftEmission = emissionSpacecraftToInert.transformPosition(Vector3D.ZERO);
final double interSatellitesRangeUsingSpacecraftCenter = 0.5 * (Vector3D.distance(pSpacecraftEmission, pSpacecraftTransit) + Vector3D.distance(pSpacecraftTransit, pSpacecraftReception));
// compute the geometrical value of the range replacing
// the spacecraft positions with antenna phase center positions
final Vector3D pAPCReception = receptionSpacecraftToInert.transformPosition(antennaPhaseCenter1);
final Vector3D pAPCTransit = transitSpacecraftToInert.transformPosition(antennaPhaseCenter2);
final Vector3D pAPCEmission = emissionSpacecraftToInert.transformPosition(antennaPhaseCenter1);
final double interSatellitesRangeUsingAntennaPhaseCenter = 0.5 * (Vector3D.distance(pAPCEmission, pAPCTransit) + Vector3D.distance(pAPCTransit, pAPCReception));
// get the estimated value before this modifier is applied
final double[] value = estimated.getEstimatedValue();
// modify the value
value[0] += interSatellitesRangeUsingAntennaPhaseCenter - interSatellitesRangeUsingSpacecraftCenter;
estimated.setEstimatedValue(value);
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class OnBoardAntennaRangeModifier method modify.
/**
* {@inheritDoc}
*/
@Override
public void modify(final EstimatedMeasurement<Range> estimated) {
// the participants are ground station at emission, spacecraft, ground station at reception
final TimeStampedPVCoordinates[] participants = estimated.getParticipants();
final Vector3D pEmission = participants[0].getPosition();
final AbsoluteDate transitDate = participants[1].getDate();
final Vector3D pReception = participants[2].getPosition();
// transform from spacecraft to inertial frame at transit date
final SpacecraftState refState = estimated.getStates()[0];
final SpacecraftState transitState = refState.shiftedBy(transitDate.durationFrom(refState.getDate()));
final Transform spacecraftToInert = transitState.toTransform().getInverse();
// compute the geometrical value of the range directly from participants positions.
// Note that this may be different from the value returned by estimated.getEstimatedValue(),
// because other modifiers may already have been taken into account
final Vector3D pSpacecraft = spacecraftToInert.transformPosition(Vector3D.ZERO);
final double rangeUsingSpacecraftCenter = 0.5 * (Vector3D.distance(pEmission, pSpacecraft) + Vector3D.distance(pSpacecraft, pReception));
// compute the geometrical value of the range replacing
// the spacecraft position with antenna phase center position
final Vector3D pAPC = spacecraftToInert.transformPosition(antennaPhaseCenter);
final double rangeUsingAntennaPhaseCenter = 0.5 * (Vector3D.distance(pEmission, pAPC) + Vector3D.distance(pAPC, pReception));
// get the estimated value before this modifier is applied
final double[] value = estimated.getEstimatedValue();
// modify the value
value[0] += rangeUsingAntennaPhaseCenter - rangeUsingSpacecraftCenter;
estimated.setEstimatedValue(value);
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class FieldSpacecraftStateTest method doTestTransform.
private <T extends RealFieldElement<T>> void doTestTransform(final Field<T> field) throws OrekitException {
T zero = field.getZero();
T a = zero.add(rOrbit.getA());
T e = zero.add(rOrbit.getE());
T i = zero.add(rOrbit.getI());
T pa = zero.add(1.9674147913622104);
T raan = zero.add(FastMath.toRadians(261));
T lv = zero.add(0);
T mass = zero.add(2500);
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, new DateComponents(2004, 01, 01), TimeComponents.H00, TimeScalesFactory.getUTC());
FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(a, e, i, pa, raan, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
BodyCenterPointing attitudeLaw = new BodyCenterPointing(orbit.getFrame(), earth);
FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit, attitudeLaw, mu, mass);
double maxDP = 0;
double maxDV = 0;
double maxDA = 0;
for (double t = 0; t < orbit.getKeplerianPeriod().getReal(); t += 60) {
final FieldSpacecraftState<T> state = propagator.propagate(orbit.getDate().shiftedBy(zero.add(t)));
final Transform transform = state.toSpacecraftState().toTransform().getInverse();
PVCoordinates pv = transform.transformPVCoordinates(PVCoordinates.ZERO);
PVCoordinates dPV = new PVCoordinates(pv, state.getPVCoordinates().toPVCoordinates());
Vector3D mZDirection = transform.transformVector(Vector3D.MINUS_K);
double alpha = Vector3D.angle(mZDirection, state.getPVCoordinates().toPVCoordinates().getPosition());
maxDP = FastMath.max(maxDP, dPV.getPosition().getNorm());
maxDV = FastMath.max(maxDV, dPV.getVelocity().getNorm());
maxDA = FastMath.max(maxDA, FastMath.toDegrees(alpha));
}
Assert.assertEquals(0.0, maxDP, 1.0e-6);
Assert.assertEquals(0.0, maxDV, 1.0e-9);
Assert.assertEquals(0.0, maxDA, 1.0e-12);
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testInitializationCorrectness.
@Test
public void testInitializationCorrectness() throws OrekitException, IOException {
// Definition of initial conditions
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
// find the default Eckstein-Hechler propagator initialized from the initial orbit
EcksteinHechlerPropagator defaultEH = new EcksteinHechlerPropagator(initial, provider);
// the osculating parameters recomputed by the default Eckstein-Hechler propagator are quite different
// from initial orbit
CircularOrbit defaultOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(defaultEH.propagateOrbit(initial.getDate()));
Assert.assertEquals(267.4, defaultOrbit.getA() - initial.getA(), 0.1);
// the position on the other hand match perfectly
Assert.assertEquals(0.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), initial.getPVCoordinates().getPosition()), 1.0e-8);
// set up a reference numerical propagator starting for the specified start orbit
// using the same force models (i.e. the first few zonal terms)
double[][] tol = NumericalPropagator.tolerances(0.1, initial, OrbitType.CIRCULAR);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
integrator.setInitialStepSize(60);
NumericalPropagator num = new NumericalPropagator(integrator);
num.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(provider)));
num.setInitialState(new SpacecraftState(initial));
num.setOrbitType(OrbitType.CIRCULAR);
// find the best Eckstein-Hechler propagator that match the orbit evolution
PropagatorConverter converter = new FiniteDifferencePropagatorConverter(new EcksteinHechlerPropagatorBuilder(initial, provider, PositionAngle.TRUE, 1.0), 1.0e-6, 100);
EcksteinHechlerPropagator fittedEH = (EcksteinHechlerPropagator) converter.convert(num, 3 * initial.getKeplerianPeriod(), 300);
// the default Eckstein-Hechler propagator did however quite a good job, as it found
// an orbit close to the best fitting
CircularOrbit fittedOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(fittedEH.propagateOrbit(initial.getDate()));
Assert.assertEquals(0.623, defaultOrbit.getA() - fittedOrbit.getA(), 0.1);
// the position on the other hand are slightly different
// because the fitted orbit minimizes the residuals over a complete time span,
// not on a single point
Assert.assertEquals(58.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), fittedOrbit.getPVCoordinates().getPosition()), 0.1);
}
use of org.orekit.frames.Transform in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue223.
@Test
public void testIssue223() throws OrekitException, IOException, ClassNotFoundException {
// Definition of initial conditions
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
propagator.propagate(initial.getDate().shiftedBy(40000));
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
Assert.assertSame(poleAligned, ephemeris.getFrame());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue(bos.size() > 2450);
Assert.assertTrue(bos.size() < 2550);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator deserialized = (BoundedPropagator) ois.readObject();
Assert.assertEquals(initial.getA(), deserialized.getInitialState().getA(), 1.0e-10);
Assert.assertEquals(initial.getEquinoctialEx(), deserialized.getInitialState().getEquinoctialEx(), 1.0e-10);
SpacecraftState s = deserialized.propagate(initial.getDate().shiftedBy(20000));
Map<String, double[]> additional = s.getAdditionalStates();
Assert.assertEquals(1, additional.size());
Assert.assertEquals(1, additional.get("seven").length);
Assert.assertEquals(7, additional.get("seven")[0], 1.0e-15);
}
Aggregations