Search in sources :

Example 6 with DateTimeComponents

use of org.orekit.time.DateTimeComponents in project Orekit by CS-SI.

the class KlobucharIonoModel method pathDelay.

/**
 * {@inheritDoc}
 */
@Override
public double pathDelay(final AbsoluteDate date, final GeodeticPoint geo, final double elevation, final double azimuth) {
    // degees to semisircles
    final double rad2semi = 1. / FastMath.PI;
    final double semi2rad = FastMath.PI;
    // Earth Centered angle
    final double psi = 0.0137 / (elevation / FastMath.PI + 0.11) - 0.022;
    // Subionospheric latitude: the latitude of the IPP (Ionospheric Pierce Point)
    // in [-0.416, 0.416], semicircle
    final double latIono = FastMath.min(FastMath.max(geo.getLatitude() * rad2semi + psi * FastMath.cos(azimuth), -0.416), 0.416);
    // Subionospheric longitude: the longitude of the IPP
    // in semicircle
    final double lonIono = geo.getLongitude() * rad2semi + (psi * FastMath.sin(azimuth) / FastMath.cos(latIono * semi2rad));
    // Geomagnetic latitude, semicircle
    final double latGeom = latIono + 0.064 * FastMath.cos((lonIono - 1.617) * semi2rad);
    // day of week and tow (sec)
    // Note: Sunday=0, Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6
    final DateTimeComponents dtc = date.getComponents(TimeScalesFactory.getGPS());
    final int dofweek = dtc.getDate().getDayOfWeek();
    final double secday = dtc.getTime().getSecondsInLocalDay();
    final double tow = dofweek * 86400. + secday;
    final double t = 43200. * lonIono + tow;
    // Seconds of day
    final double tsec = t - FastMath.floor(t / 86400.) * 86400;
    // Slant factor, semicircle
    final double slantFactor = 1.0 + 16.0 * FastMath.pow(0.53 - elevation / FastMath.PI, 3);
    // Period of model, seconds
    final double period = FastMath.max(72000., beta[0] + (beta[1] + (beta[2] + beta[3] * latGeom) * latGeom) * latGeom);
    // Phase of the model, radians
    // (Max at 14.00 = 50400 sec local time)
    final double x = 2.0 * FastMath.PI * (tsec - 50400.0) / period;
    // Amplitude of the model, seconds
    final double amplitude = FastMath.max(0, alpha[0] + (alpha[1] + (alpha[2] + alpha[3] * latGeom) * latGeom) * latGeom);
    // Ionospheric correction (L1)
    double ionoTimeDelayL1 = slantFactor * (5. * 1e-9);
    if (FastMath.abs(x) < 1.570) {
        ionoTimeDelayL1 += slantFactor * (amplitude * (1.0 - FastMath.pow(x, 2) / 2.0 + FastMath.pow(x, 4) / 24.0));
    }
    // Ionospheric delay for the L1 frequency, in meters, with slant correction.
    return ratio * Constants.SPEED_OF_LIGHT * ionoTimeDelayL1;
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) DateTimeComponents(org.orekit.time.DateTimeComponents)

Example 7 with DateTimeComponents

use of org.orekit.time.DateTimeComponents in project Orekit by CS-SI.

the class TLE method buildLine1.

/**
 * Build the line 1 from the parsed elements.
 * @exception OrekitException if UTC conversion cannot be done or
 * some parameter is too large to fit format
 */
private void buildLine1() throws OrekitException {
    final StringBuffer buffer = new StringBuffer();
    buffer.append('1');
    buffer.append(' ');
    buffer.append(addPadding("satelliteNumber-1", satelliteNumber, '0', 5, true));
    buffer.append(classification);
    buffer.append(' ');
    buffer.append(addPadding("launchYear", launchYear % 100, '0', 2, true));
    buffer.append(addPadding("launchNumber", launchNumber, '0', 3, true));
    buffer.append(addPadding("launchPiece", launchPiece, ' ', 3, false));
    buffer.append(' ');
    final DateTimeComponents dtc = epoch.getComponents(TimeScalesFactory.getUTC());
    buffer.append(addPadding("year", dtc.getDate().getYear() % 100, '0', 2, true));
    buffer.append(addPadding("day", dtc.getDate().getDayOfYear(), '0', 3, true));
    buffer.append('.');
    // nota: 31250/27 == 100000000/86400
    final int fraction = (int) FastMath.rint(31250 * dtc.getTime().getSecondsInUTCDay() / 27.0);
    buffer.append(addPadding("fraction", fraction, '0', 8, true));
    buffer.append(' ');
    final double n1 = meanMotionFirstDerivative * 1.86624e9 / FastMath.PI;
    final String sn1 = addPadding("meanMotionFirstDerivative", new DecimalFormat(".00000000", SYMBOLS).format(n1), ' ', 10, true);
    buffer.append(sn1);
    buffer.append(' ');
    final double n2 = meanMotionSecondDerivative * 5.3747712e13 / FastMath.PI;
    buffer.append(formatExponentMarkerFree("meanMotionSecondDerivative", n2, 5, ' ', 8, true));
    buffer.append(' ');
    buffer.append(formatExponentMarkerFree("B*", bStar, 5, ' ', 8, true));
    buffer.append(' ');
    buffer.append(ephemerisType);
    buffer.append(' ');
    buffer.append(addPadding("elementNumber", elementNumber, ' ', 4, true));
    buffer.append(Integer.toString(checksum(buffer)));
    line1 = buffer.toString();
}
Also used : DecimalFormat(java.text.DecimalFormat) DateTimeComponents(org.orekit.time.DateTimeComponents)

Aggregations

DateTimeComponents (org.orekit.time.DateTimeComponents)7 GeodeticPoint (org.orekit.bodies.GeodeticPoint)4 AbsoluteDate (org.orekit.time.AbsoluteDate)3 DecimalFormat (java.text.DecimalFormat)2 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)2 OrekitException (org.orekit.errors.OrekitException)2 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 Test (org.junit.Test)1 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)1 TimeComponents (org.orekit.time.TimeComponents)1 TimeScale (org.orekit.time.TimeScale)1