Search in sources :

Example 11 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class KalmanOrbitDeterminationTest method createStationsData.

/**
 * Set up stations.
 * @param parser input file parser
 * @param body central body
 * @return name to station data map
 * @exception OrekitException if some frame transforms cannot be computed
 * @throws NoSuchElementException if input parameters are missing
 */
private Map<String, StationData> createStationsData(final KeyValueFileParser<ParameterKey> parser, final OneAxisEllipsoid body) throws OrekitException, NoSuchElementException {
    final Map<String, StationData> stations = new HashMap<String, StationData>();
    final String[] stationNames = parser.getStringArray(ParameterKey.GROUND_STATION_NAME);
    final double[] stationLatitudes = parser.getAngleArray(ParameterKey.GROUND_STATION_LATITUDE);
    final double[] stationLongitudes = parser.getAngleArray(ParameterKey.GROUND_STATION_LONGITUDE);
    final double[] stationAltitudes = parser.getDoubleArray(ParameterKey.GROUND_STATION_ALTITUDE);
    final boolean[] stationPositionEstimated = parser.getBooleanArray(ParameterKey.GROUND_STATION_POSITION_ESTIMATED);
    final double[] stationRangeSigma = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_SIGMA);
    final double[] stationRangeBias = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_BIAS);
    final double[] stationRangeBiasMin = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_BIAS_MIN);
    final double[] stationRangeBiasMax = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_BIAS_MAX);
    final boolean[] stationRangeBiasEstimated = parser.getBooleanArray(ParameterKey.GROUND_STATION_RANGE_BIAS_ESTIMATED);
    final double[] stationRangeRateSigma = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_RATE_SIGMA);
    final double[] stationRangeRateBias = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_RATE_BIAS);
    final double[] stationRangeRateBiasMin = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_RATE_BIAS_MIN);
    final double[] stationRangeRateBiasMax = parser.getDoubleArray(ParameterKey.GROUND_STATION_RANGE_RATE_BIAS_MAX);
    final boolean[] stationRangeRateBiasEstimated = parser.getBooleanArray(ParameterKey.GROUND_STATION_RANGE_RATE_BIAS_ESTIMATED);
    final double[] stationAzimuthSigma = parser.getAngleArray(ParameterKey.GROUND_STATION_AZIMUTH_SIGMA);
    final double[] stationAzimuthBias = parser.getAngleArray(ParameterKey.GROUND_STATION_AZIMUTH_BIAS);
    final double[] stationAzimuthBiasMin = parser.getAngleArray(ParameterKey.GROUND_STATION_AZIMUTH_BIAS_MIN);
    final double[] stationAzimuthBiasMax = parser.getAngleArray(ParameterKey.GROUND_STATION_AZIMUTH_BIAS_MAX);
    final double[] stationElevationSigma = parser.getAngleArray(ParameterKey.GROUND_STATION_ELEVATION_SIGMA);
    final double[] stationElevationBias = parser.getAngleArray(ParameterKey.GROUND_STATION_ELEVATION_BIAS);
    final double[] stationElevationBiasMin = parser.getAngleArray(ParameterKey.GROUND_STATION_ELEVATION_BIAS_MIN);
    final double[] stationElevationBiasMax = parser.getAngleArray(ParameterKey.GROUND_STATION_ELEVATION_BIAS_MAX);
    final boolean[] stationAzElBiasesEstimated = parser.getBooleanArray(ParameterKey.GROUND_STATION_AZ_EL_BIASES_ESTIMATED);
    final boolean[] stationElevationRefraction = parser.getBooleanArray(ParameterKey.GROUND_STATION_ELEVATION_REFRACTION_CORRECTION);
    final boolean[] stationRangeTropospheric = parser.getBooleanArray(ParameterKey.GROUND_STATION_RANGE_TROPOSPHERIC_CORRECTION);
    for (int i = 0; i < stationNames.length; ++i) {
        // the station itself
        final GeodeticPoint position = new GeodeticPoint(stationLatitudes[i], stationLongitudes[i], stationAltitudes[i]);
        final TopocentricFrame topo = new TopocentricFrame(body, position, stationNames[i]);
        final GroundStation station = new GroundStation(topo);
        station.getEastOffsetDriver().setSelected(stationPositionEstimated[i]);
        station.getNorthOffsetDriver().setSelected(stationPositionEstimated[i]);
        station.getZenithOffsetDriver().setSelected(stationPositionEstimated[i]);
        // range
        final double rangeSigma = stationRangeSigma[i];
        final Bias<Range> rangeBias;
        if (FastMath.abs(stationRangeBias[i]) >= Precision.SAFE_MIN || stationRangeBiasEstimated[i]) {
            rangeBias = new Bias<Range>(new String[] { stationNames[i] + "/range bias" }, new double[] { stationRangeBias[i] }, new double[] { rangeSigma }, new double[] { stationRangeBiasMin[i] }, new double[] { stationRangeBiasMax[i] });
            rangeBias.getParametersDrivers().get(0).setSelected(stationRangeBiasEstimated[i]);
        } else {
            // bias fixed to zero, we don't need to create a modifier for this
            rangeBias = null;
        }
        // range rate
        final double rangeRateSigma = stationRangeRateSigma[i];
        final Bias<RangeRate> rangeRateBias;
        if (FastMath.abs(stationRangeRateBias[i]) >= Precision.SAFE_MIN || stationRangeRateBiasEstimated[i]) {
            rangeRateBias = new Bias<RangeRate>(new String[] { stationNames[i] + "/range rate bias" }, new double[] { stationRangeRateBias[i] }, new double[] { rangeRateSigma }, new double[] { stationRangeRateBiasMin[i] }, new double[] { stationRangeRateBiasMax[i] });
            rangeRateBias.getParametersDrivers().get(0).setSelected(stationRangeRateBiasEstimated[i]);
        } else {
            // bias fixed to zero, we don't need to create a modifier for this
            rangeRateBias = null;
        }
        // angular biases
        final double[] azELSigma = new double[] { stationAzimuthSigma[i], stationElevationSigma[i] };
        final Bias<AngularAzEl> azELBias;
        if (FastMath.abs(stationAzimuthBias[i]) >= Precision.SAFE_MIN || FastMath.abs(stationElevationBias[i]) >= Precision.SAFE_MIN || stationAzElBiasesEstimated[i]) {
            azELBias = new Bias<AngularAzEl>(new String[] { stationNames[i] + "/az bias", stationNames[i] + "/el bias" }, new double[] { stationAzimuthBias[i], stationElevationBias[i] }, azELSigma, new double[] { stationAzimuthBiasMin[i], stationElevationBiasMin[i] }, new double[] { stationAzimuthBiasMax[i], stationElevationBiasMax[i] });
            azELBias.getParametersDrivers().get(0).setSelected(stationAzElBiasesEstimated[i]);
            azELBias.getParametersDrivers().get(1).setSelected(stationAzElBiasesEstimated[i]);
        } else {
            // bias fixed to zero, we don't need to create a modifier for this
            azELBias = null;
        }
        // Refraction correction
        final AngularRadioRefractionModifier refractionCorrection;
        if (stationElevationRefraction[i]) {
            final double altitude = station.getBaseFrame().getPoint().getAltitude();
            final AtmosphericRefractionModel refractionModel = new EarthITU453AtmosphereRefraction(altitude);
            refractionCorrection = new AngularRadioRefractionModifier(refractionModel);
        } else {
            refractionCorrection = null;
        }
        // Tropospheric correction
        final RangeTroposphericDelayModifier rangeTroposphericCorrection;
        if (stationRangeTropospheric[i]) {
            final SaastamoinenModel troposphericModel = SaastamoinenModel.getStandardModel();
            rangeTroposphericCorrection = new RangeTroposphericDelayModifier(troposphericModel);
        } else {
            rangeTroposphericCorrection = null;
        }
        stations.put(stationNames[i], new StationData(station, rangeSigma, rangeBias, rangeRateSigma, rangeRateBias, azELSigma, azELBias, refractionCorrection, rangeTroposphericCorrection));
    }
    return stations;
}
Also used : GroundStation(org.orekit.estimation.measurements.GroundStation) HashMap(java.util.HashMap) EarthITU453AtmosphereRefraction(org.orekit.models.earth.EarthITU453AtmosphereRefraction) TopocentricFrame(org.orekit.frames.TopocentricFrame) AngularRadioRefractionModifier(org.orekit.estimation.measurements.modifiers.AngularRadioRefractionModifier) AtmosphericRefractionModel(org.orekit.models.AtmosphericRefractionModel) Range(org.orekit.estimation.measurements.Range) RangeTroposphericDelayModifier(org.orekit.estimation.measurements.modifiers.RangeTroposphericDelayModifier) GeodeticPoint(org.orekit.bodies.GeodeticPoint) RangeRate(org.orekit.estimation.measurements.RangeRate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AngularAzEl(org.orekit.estimation.measurements.AngularAzEl) SaastamoinenModel(org.orekit.models.earth.SaastamoinenModel)

Example 12 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class NRLMSISE00 method getDensity.

/**
 * {@inheritDoc}
 */
@Override
public double getDensity(final AbsoluteDate date, final Vector3D position, final Frame frame) throws OrekitException {
    // check if data are available :
    if ((date.compareTo(inputParams.getMaxDate()) > 0) || (date.compareTo(inputParams.getMinDate()) < 0)) {
        throw new OrekitException(OrekitMessages.NO_SOLAR_ACTIVITY_AT_DATE, date, inputParams.getMinDate(), inputParams.getMaxDate());
    }
    // compute day number in current year and the seconds within the day
    final DateTimeComponents dtc = date.getComponents(TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true));
    final int doy = dtc.getDate().getDayOfYear();
    final double sec = dtc.getTime().getSecondsInLocalDay();
    // compute geodetic position (km and °)
    final GeodeticPoint inBody = earth.transform(position, frame, date);
    final double alt = inBody.getAltitude() / 1000.;
    final double lon = FastMath.toDegrees(inBody.getLongitude());
    final double lat = FastMath.toDegrees(inBody.getLatitude());
    // compute local solar time
    final double lst = localSolarTime(date, position, frame);
    // get solar activity data and compute
    final Output out = new Output(doy, sec, lat, lon, lst, inputParams.getAverageFlux(date), inputParams.getDailyFlux(date), inputParams.getAp(date));
    out.gtd7d(alt);
    // return the local density
    return out.getDensity(TOTAL_MASS);
}
Also used : OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) DateTimeComponents(org.orekit.time.DateTimeComponents)

Example 13 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Phasing method printGridPoints.

/**
 * Print ground track grid point
 * @param out output stream
 * @param latitude point latitude
 * @param ascending indicator for latitude crossing direction
 * @param orbit phased orbit
 * @param propagator propagator for orbit
 * @param nbOrbits number of orbits in the cycle
 * @exception OrekitException if orbit cannot be propagated
 */
private void printGridPoints(final PrintStream out, final double latitude, final boolean ascending, final Orbit orbit, final Propagator propagator, int nbOrbits) throws OrekitException {
    propagator.resetInitialState(new SpacecraftState(orbit));
    AbsoluteDate start = orbit.getDate();
    // find the first latitude crossing
    double period = orbit.getKeplerianPeriod();
    double stepSize = period / 100;
    SpacecraftState crossing = findFirstCrossing(latitude, ascending, start, start.shiftedBy(2 * period), stepSize, propagator);
    // find all other latitude crossings from regular schedule
    DecimalFormat fTime = new DecimalFormat("0000000.000", new DecimalFormatSymbols(Locale.US));
    DecimalFormat fAngle = new DecimalFormat("000.00000", new DecimalFormatSymbols(Locale.US));
    while (nbOrbits-- > 0) {
        GeodeticPoint gp = earth.transform(crossing.getPVCoordinates().getPosition(), crossing.getFrame(), crossing.getDate());
        out.println(fTime.format(crossing.getDate().durationFrom(start)) + " " + fAngle.format(FastMath.toDegrees(gp.getLatitude())) + " " + fAngle.format(FastMath.toDegrees(gp.getLongitude())) + " " + ascending);
        final AbsoluteDate previousDate = crossing.getDate();
        crossing = findLatitudeCrossing(latitude, previousDate.shiftedBy(period), previousDate.shiftedBy(2 * period), stepSize, period / 8, propagator);
        period = crossing.getDate().durationFrom(previousDate);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) DecimalFormatSymbols(java.text.DecimalFormatSymbols) DecimalFormat(java.text.DecimalFormat) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 14 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Phasing method improveEarthPhasing.

/**
 * Improve orbit to better match Earth phasing parameters.
 * @param previous previous orbit
 * @param nbOrbits number of orbits in the phasing cycle
 * @param nbDays number of days in the phasing cycle
 * @param propagator propagator to use
 * @return an improved Earth phased orbit
 * @exception OrekitException if orbit cannot be propagated
 */
private CircularOrbit improveEarthPhasing(CircularOrbit previous, int nbOrbits, int nbDays, Propagator propagator) throws OrekitException {
    propagator.resetInitialState(new SpacecraftState(previous));
    // find first ascending node
    double period = previous.getKeplerianPeriod();
    SpacecraftState firstState = findFirstCrossing(0.0, true, previous.getDate(), previous.getDate().shiftedBy(2 * period), 0.01 * period, propagator);
    // go to next cycle, one orbit at a time
    SpacecraftState state = firstState;
    for (int i = 0; i < nbOrbits; ++i) {
        final AbsoluteDate previousDate = state.getDate();
        state = findLatitudeCrossing(0.0, previousDate.shiftedBy(period), previousDate.shiftedBy(2 * period), 0.01 * period, period, propagator);
        period = state.getDate().durationFrom(previousDate);
    }
    double cycleDuration = state.getDate().durationFrom(firstState.getDate());
    double deltaT;
    if (((int) FastMath.rint(cycleDuration / Constants.JULIAN_DAY)) != nbDays) {
        // we are very far from expected duration
        deltaT = nbDays * Constants.JULIAN_DAY - cycleDuration;
    } else {
        // we are close to expected duration
        GeodeticPoint startPoint = earth.transform(firstState.getPVCoordinates().getPosition(), firstState.getFrame(), firstState.getDate());
        GeodeticPoint endPoint = earth.transform(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
        double deltaL = MathUtils.normalizeAngle(endPoint.getLongitude() - startPoint.getLongitude(), 0.0);
        deltaT = deltaL * Constants.JULIAN_DAY / (2 * FastMath.PI);
    }
    double deltaA = 2 * previous.getA() * deltaT / (3 * nbOrbits * previous.getKeplerianPeriod());
    return new CircularOrbit(previous.getA() + deltaA, previous.getCircularEx(), previous.getCircularEy(), previous.getI(), previous.getRightAscensionOfAscendingNode(), previous.getAlphaV(), PositionAngle.TRUE, previous.getFrame(), previous.getDate(), previous.getMu());
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate)

Example 15 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Phasing method findLatitudeCrossing.

/**
 * Find the state at which the reference latitude is crossed.
 * @param latitude latitude to search for
 * @param guessDate guess date for the crossing
 * @param endDate maximal date not to overtake
 * @param shift shift value used to evaluate the latitude function bracketing around the guess date
 * @param maxShift maximum value that the shift value can take
 * @param propagator propagator used
 * @return state at latitude crossing time
 * @throws OrekitException if state cannot be propagated
 * @throws MathRuntimeException if latitude cannot be bracketed in the search interval
 */
private SpacecraftState findLatitudeCrossing(final double latitude, final AbsoluteDate guessDate, final AbsoluteDate endDate, final double shift, final double maxShift, final Propagator propagator) throws OrekitException, MathRuntimeException {
    // function evaluating to 0 at latitude crossings
    final UnivariateFunction latitudeFunction = new UnivariateFunction() {

        /**
         * {@inheritDoc}
         */
        public double value(double x) {
            try {
                final SpacecraftState state = propagator.propagate(guessDate.shiftedBy(x));
                final Vector3D position = state.getPVCoordinates(earth.getBodyFrame()).getPosition();
                final GeodeticPoint point = earth.transform(position, earth.getBodyFrame(), state.getDate());
                return point.getLatitude() - latitude;
            } catch (OrekitException oe) {
                throw new RuntimeException(oe);
            }
        }
    };
    // try to bracket the encounter
    double span;
    if (guessDate.shiftedBy(shift).compareTo(endDate) > 0) {
        // Take a 1e-3 security margin
        span = endDate.durationFrom(guessDate) - 1e-3;
    } else {
        span = shift;
    }
    while (!UnivariateSolverUtils.isBracketing(latitudeFunction, -span, span)) {
        if (2 * span > maxShift) {
            // let the Hipparchus exception be thrown
            UnivariateSolverUtils.verifyBracketing(latitudeFunction, -span, span);
        } else if (guessDate.shiftedBy(2 * span).compareTo(endDate) > 0) {
            // Out of range :
            return null;
        }
        // expand the search interval
        span *= 2;
    }
    // find the encounter in the bracketed interval
    final BaseUnivariateSolver<UnivariateFunction> solver = new BracketingNthOrderBrentSolver(0.1, 5);
    final double dt = solver.solve(1000, latitudeFunction, -span, span);
    return propagator.propagate(guessDate.shiftedBy(dt));
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) MathRuntimeException(org.hipparchus.exception.MathRuntimeException) UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) BracketingNthOrderBrentSolver(org.hipparchus.analysis.solvers.BracketingNthOrderBrentSolver)

Aggregations

GeodeticPoint (org.orekit.bodies.GeodeticPoint)133 Test (org.junit.Test)78 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)67 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)61 AbsoluteDate (org.orekit.time.AbsoluteDate)45 TopocentricFrame (org.orekit.frames.TopocentricFrame)35 Frame (org.orekit.frames.Frame)34 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)27 SpacecraftState (org.orekit.propagation.SpacecraftState)26 Propagator (org.orekit.propagation.Propagator)24 OrekitException (org.orekit.errors.OrekitException)23 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)23 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)22 PVCoordinates (org.orekit.utils.PVCoordinates)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 BodyShape (org.orekit.bodies.BodyShape)17 Orbit (org.orekit.orbits.Orbit)15 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 ArrayList (java.util.ArrayList)12 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)12