BeidouPropagator.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 Beidou orbit from {@link BeidouOrbitalElements}.
  27.  *
  28.  * @see <a href="http://www2.unb.ca/gge/Resources/beidou_icd_english_ver2.0.pdf">Beidou Interface Control Document</a>
  29.  *
  30.  * @author Bryan Cazabonne
  31.  * @since 10.0
  32.  *
  33.  */
  34. public class BeidouPropagator extends AbstractGNSSPropagator {

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

  38.     /** Duration of the Beidou cycle in seconds. */
  39.     private static final double BEIDOU_CYCLE_DURATION = BeidouOrbitalElements.BEIDOU_WEEK_IN_SECONDS *
  40.                                                         BeidouOrbitalElements.BEIDOU_WEEK_NB;

  41.     // Fields
  42.     /** The Beidou orbital elements used. */
  43.     private final BeidouOrbitalElements bdsOrbit;

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

  50.         // Required parameter
  51.         /** The Beidou orbital elements. */
  52.         private final BeidouOrbitalElements orbit;

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

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

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

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

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

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

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

  155.         /** Finalizes the build.
  156.          *
  157.          * @return the built BeidouPropagator
  158.          */
  159.         public BeidouPropagator build() {
  160.             return new BeidouPropagator(this);
  161.         }
  162.     }

  163.     /**
  164.      * Private constructor.
  165.      *
  166.      * @param builder the builder
  167.      */
  168.     private BeidouPropagator(final Builder builder) {
  169.         super(builder.orbit, builder.attitudeProvider,
  170.               builder.eci, builder.ecef, builder.mass,
  171.               BEIDOU_AV, BEIDOU_CYCLE_DURATION, BeidouOrbitalElements.BEIDOU_MU);
  172.         // Stores the Beidou orbital elements
  173.         this.bdsOrbit = builder.orbit;
  174.     }

  175.     /**
  176.      * Get the underlying Beidou orbital elements.
  177.      *
  178.      * @return the underlying Beidou orbital elements
  179.      */
  180.     public BeidouOrbitalElements getBeidouOrbitalElements() {
  181.         return bdsOrbit;
  182.     }

  183. }