IRNSSPropagator.java

  1. /* Copyright 2002-2020 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.propagation.analytical.gnss;

  18. import org.orekit.attitudes.AttitudeProvider;
  19. import org.orekit.attitudes.InertialProvider;
  20. import org.orekit.frames.Frame;
  21. import org.orekit.frames.Frames;
  22. import org.orekit.utils.IERSConventions;

  23. /**
  24.  * This class aims at propagating a IRNSS orbit from {@link IRNSSOrbitalElements}.
  25.  *
  26.  * @see "Indian Regional Navigation Satellite System, Signal In Space ICD
  27.  *       for standard positioning service, version 1.1"
  28.  *
  29.  * @author Bryan Cazabonne
  30.  * @since 10.1
  31.  */
  32. public class IRNSSPropagator extends AbstractGNSSPropagator {

  33.     // Constants
  34.     /** WGS 84 value of the earth's rotation rate in rad/s. */
  35.     private static final double IRNSS_AV = 7.2921151467e-5;

  36.     /** Duration of the IRNSS cycle in seconds. */
  37.     private static final double IRNSS_CYCLE_DURATION = IRNSSOrbitalElements.IRNSS_WEEK_IN_SECONDS *
  38.                                                        IRNSSOrbitalElements.IRNSS_WEEK_NB;

  39.     // Fields
  40.     /** The IRNSS orbital elements used. */
  41.     private final IRNSSOrbitalElements irnssOrbit;

  42.     /**
  43.      * This nested class aims at building a IRNSSPropagator.
  44.      * <p>It implements the classical builder pattern.</p>
  45.      *
  46.      */
  47.     public static class Builder {

  48.         // Required parameter
  49.         /** The IRNSS orbital elements. */
  50.         private final IRNSSOrbitalElements orbit;

  51.         // Optional parameters
  52.         /** The attitude provider. */
  53.         private AttitudeProvider attitudeProvider;
  54.         /** The mass. */
  55.         private double mass = DEFAULT_MASS;
  56.         /** The ECI frame. */
  57.         private Frame eci  = null;
  58.         /** The ECEF frame. */
  59.         private Frame ecef = null;

  60.         /** Initializes the builder.
  61.          * <p>The IRNSS orbital elements is the only requested parameter to build a IRNSSPropagator.</p>
  62.          * <p>The attitude provider is set by default to be aligned with the J2000 frame.<br>
  63.          * The mass is set by default to the
  64.          *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  65.          * The ECI frame is set by default to the
  66.          *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
  67.          * The ECEF frame is set by default to the
  68.          *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
  69.          * </p>
  70.          *
  71.          * @param irnssOrbElt the IRNSS orbital elements to be used by the IRNSSpropagator.
  72.          * @param frames      set of reference frames to use to initialize {@link
  73.          *                    #ecef(Frame)}, {@link #eci(Frame)}, and {@link
  74.          *                    #attitudeProvider(AttitudeProvider)}.
  75.          * @see #attitudeProvider(AttitudeProvider provider)
  76.          * @see #mass(double mass)
  77.          * @see #eci(Frame inertial)
  78.          * @see #ecef(Frame bodyFixed)
  79.          */
  80.         public Builder(final IRNSSOrbitalElements irnssOrbElt, final Frames frames) {
  81.             this.orbit = irnssOrbElt;
  82.             this.eci   = frames.getEME2000();
  83.             this.ecef  = frames.getITRF(IERSConventions.IERS_2010, true);
  84.             this.attitudeProvider = new InertialProvider(eci);
  85.         }

  86.         /** Sets the attitude provider.
  87.          *
  88.          * @param userProvider the attitude provider
  89.          * @return the updated builder
  90.          */
  91.         public Builder attitudeProvider(final AttitudeProvider userProvider) {
  92.             this.attitudeProvider = userProvider;
  93.             return this;
  94.         }

  95.         /** Sets the mass.
  96.          *
  97.          * @param userMass the mass (in kg)
  98.          * @return the updated builder
  99.          */
  100.         public Builder mass(final double userMass) {
  101.             this.mass = userMass;
  102.             return this;
  103.         }

  104.         /** Sets the Earth Centered Inertial frame used for propagation.
  105.          *
  106.          * @param inertial the ECI frame
  107.          * @return the updated builder
  108.          */
  109.         public Builder eci(final Frame inertial) {
  110.             this.eci = inertial;
  111.             return this;
  112.         }

  113.         /** Sets the Earth Centered Earth Fixed frame assimilated to the WGS84 ECEF.
  114.          *
  115.          * @param bodyFixed the ECEF frame
  116.          * @return the updated builder
  117.          */
  118.         public Builder ecef(final Frame bodyFixed) {
  119.             this.ecef = bodyFixed;
  120.             return this;
  121.         }

  122.         /** Finalizes the build.
  123.          *
  124.          * @return the built IRNSSPropagator
  125.          */
  126.         public IRNSSPropagator build() {
  127.             return new IRNSSPropagator(this);
  128.         }
  129.     }

  130.     /**
  131.      * Private constructor.
  132.      *
  133.      * @param builder the builder
  134.      */
  135.     private IRNSSPropagator(final Builder builder) {
  136.         super(builder.orbit, builder.attitudeProvider,
  137.               builder.eci, builder.ecef, builder.mass,
  138.               IRNSS_AV, IRNSS_CYCLE_DURATION, IRNSSOrbitalElements.IRNSS_MU);
  139.         // Stores the IRNSS orbital elements
  140.         this.irnssOrbit = builder.orbit;
  141.     }

  142.     /**
  143.      * Gets the underlying IRNSS orbital elements.
  144.      *
  145.      * @return the underlying IRNSS orbital elements
  146.      */
  147.     public IRNSSOrbitalElements getIRNSSOrbitalElements() {
  148.         return irnssOrbit;
  149.     }

  150. }