GalileoPropagator.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.annotation.DefaultDataContext;
  19. import org.orekit.attitudes.AttitudeProvider;
  20. import org.orekit.data.DataContext;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.frames.Frames;
  23. import org.orekit.propagation.Propagator;
  24. import org.orekit.utils.IERSConventions;

  25. /**
  26.  * This class aims at propagating a Galileo orbit from {@link GalileoOrbitalElements}.
  27.  *
  28.  * @see <a href="https://www.gsc-europa.eu/system/files/galileo_documents/Galileo-OS-SIS-ICD.pdf">Galileo Interface Control Document</a>
  29.  *
  30.  * @author Bryan Cazabonne
  31.  *
  32.  */
  33. public class GalileoPropagator extends AbstractGNSSPropagator {

  34.     // Constants
  35.     /** Value of the earth's rotation rate in rad/s. */
  36.     private static final double GALILEO_AV = 7.2921151467e-5;

  37.     /** Duration of the Galileo cycle in seconds. */
  38.     private static final double GALILEO_CYCLE_DURATION = GalileoOrbitalElements.GALILEO_WEEK_IN_SECONDS *
  39.                                                          GalileoOrbitalElements.GALILEO_WEEK_NB;

  40.     // Fields
  41.     /** The Galileo orbital elements used. */
  42.     private final GalileoOrbitalElements galileoOrbit;

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

  49.         // Required parameter
  50.         /** The Galileo orbital elements. */
  51.         private final GalileoOrbitalElements orbit;

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

  61.         /** Initializes the builder.
  62.          * <p>The Galileo orbital elements is the only requested parameter to build a GalileoPropagator.</p>
  63.          * <p>The attitude provider is set by default to the
  64.          *  {@link org.orekit.propagation.Propagator#DEFAULT_LAW DEFAULT_LAW} in the
  65.          *  default data context.<br>
  66.          * The mass is set by default to the
  67.          *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  68.          * The ECI frame is set by default to the
  69.          *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
  70.          *  context.<br>
  71.          * The ECEF frame is set by default to the
  72.          *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
  73.          *  CIO/2010-based ITRF simple EOP} in the default data context.
  74.          * </p>
  75.          *
  76.          * <p>This constructor uses the {@link DataContext#getDefault() default data context}.
  77.          * Another data context can be set using
  78.          * {@code Builder(final GalileoOrbitalElements gpsOrbElt, final Frames frames)}</p>
  79.          *
  80.          * @param galileoOrbElt the Galileo orbital elements to be used by the Galileo propagator.
  81.          * @see #attitudeProvider(AttitudeProvider provider)
  82.          * @see #mass(double mass)
  83.          * @see #eci(Frame inertial)
  84.          * @see #ecef(Frame bodyFixed)
  85.          */
  86.         @DefaultDataContext
  87.         public Builder(final GalileoOrbitalElements galileoOrbElt) {
  88.             this(galileoOrbElt, DataContext.getDefault().getFrames());
  89.         }

  90.         /** Initializes the builder.
  91.          * <p>The Galileo orbital elements is the only requested parameter to build a GalileoPropagator.</p>
  92.          * <p>The attitude provider is set by default to the
  93.          *  {@link org.orekit.propagation.Propagator#getDefaultLaw(Frames) DEFAULT_LAW}.<br>
  94.          * The mass is set by default to the
  95.          *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  96.          * The ECI frame is set by default to the
  97.          *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
  98.          * The ECEF frame is set by default to the
  99.          *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
  100.          * </p>
  101.          *
  102.          * @param galileoOrbElt the Galileo orbital elements to be used by the Galileo propagator.
  103.          * @param frames to use building the propagator.
  104.          * @see #attitudeProvider(AttitudeProvider provider)
  105.          * @see #mass(double mass)
  106.          * @see #eci(Frame inertial)
  107.          * @see #ecef(Frame bodyFixed)
  108.          * @since 10.1
  109.          */
  110.         public Builder(final GalileoOrbitalElements galileoOrbElt, final Frames frames) {
  111.             this.orbit = galileoOrbElt;
  112.             this.eci   = frames.getEME2000();
  113.             this.ecef  = frames.getITRF(IERSConventions.IERS_2010, true);
  114.             attitudeProvider = Propagator.getDefaultLaw(frames);
  115.         }

  116.         /** Sets the attitude provider.
  117.          *
  118.          * @param userProvider the attitude provider
  119.          * @return the updated builder
  120.          */
  121.         public Builder attitudeProvider(final AttitudeProvider userProvider) {
  122.             this.attitudeProvider = userProvider;
  123.             return this;
  124.         }

  125.         /** Sets the mass.
  126.          *
  127.          * @param userMass the mass (in kg)
  128.          * @return the updated builder
  129.          */
  130.         public Builder mass(final double userMass) {
  131.             this.mass = userMass;
  132.             return this;
  133.         }

  134.         /** Sets the Earth Centered Inertial frame used for propagation.
  135.          *
  136.          * @param inertial the ECI frame
  137.          * @return the updated builder
  138.          */
  139.         public Builder eci(final Frame inertial) {
  140.             this.eci = inertial;
  141.             return this;
  142.         }

  143.         /** Sets the Earth Centered Earth Fixed frame.
  144.          *
  145.          * @param bodyFixed the ECEF frame
  146.          * @return the updated builder
  147.          */
  148.         public Builder ecef(final Frame bodyFixed) {
  149.             this.ecef = bodyFixed;
  150.             return this;
  151.         }

  152.         /** Finalizes the build.
  153.          *
  154.          * @return the built GalileoPropagator
  155.          */
  156.         public GalileoPropagator build() {
  157.             return new GalileoPropagator(this);
  158.         }
  159.     }

  160.     /**
  161.      * Private constructor.
  162.      *
  163.      * @param builder the builder
  164.      */
  165.     private GalileoPropagator(final Builder builder) {
  166.         super(builder.orbit, builder.attitudeProvider,
  167.               builder.eci, builder.ecef, builder.mass,
  168.               GALILEO_AV, GALILEO_CYCLE_DURATION, GalileoOrbitalElements.GALILEO_MU);
  169.         // Stores the Galileo orbital elements
  170.         this.galileoOrbit = builder.orbit;
  171.     }

  172.     /**
  173.      * Get the underlying Galileo orbital elements.
  174.      *
  175.      * @return the underlying Galileo orbital elements
  176.      */
  177.     public GalileoOrbitalElements getGalileoOrbitalElements() {
  178.         return galileoOrbit;
  179.     }

  180. }