QZSSPropagator.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 QZSS orbit from {@link QZSSOrbitalElements}.
  27.  *
  28.  * @see <a href="http://qzss.go.jp/en/technical/download/pdf/ps-is-qzss/is-qzss-pnt-003.pdf?t=1549268771755">
  29.  *       QZSS Interface Specification</a>
  30.  *
  31.  * @author Bryan Cazabonne
  32.  * @since 10.0
  33.  *
  34.  */
  35. public class QZSSPropagator extends AbstractGNSSPropagator {

  36.     // Constants
  37.     /** WGS 84 value of the earth's rotation rate in rad/s. */
  38.     private static final double QZSS_AV = 7.2921151467e-5;

  39.     /** Duration of the QZSS cycle in seconds. */
  40.     private static final double QZSS_CYCLE_DURATION = QZSSOrbitalElements.QZSS_WEEK_IN_SECONDS *
  41.                                                       QZSSOrbitalElements.QZSS_WEEK_NB;

  42.     // Fields
  43.     /** The QZSS orbital elements used. */
  44.     private final QZSSOrbitalElements qzssOrbit;

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

  51.         // Required parameter
  52.         /** The QZSS orbital elements. */
  53.         private final QZSSOrbitalElements orbit;

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

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

  92.         /** Initializes the builder.
  93.          * <p>The QZSS orbital elements is the only requested parameter to build a QZSSPropagator.</p>
  94.          * <p>The attitude provider is set by default to the
  95.          *  {@link org.orekit.propagation.Propagator#getDefaultLaw(Frames)}.<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 Frames#getEME2000()}  EME2000 frame}.<br>
  100.          * The ECEF frame is set by default to the
  101.          *  {@link Frames#getITRF(IERSConventions, boolean)} CIO/2010-based ITRF simple EOP}.
  102.          * </p>
  103.          *
  104.          * @param qzssOrbElt the QZSS orbital elements to be used by the QZSSpropagator.
  105.          * @param frames set of frames to use.
  106.          * @see #attitudeProvider(AttitudeProvider provider)
  107.          * @see #mass(double mass)
  108.          * @see #eci(Frame inertial)
  109.          * @see #ecef(Frame bodyFixed)
  110.          * @since 10.1
  111.          */
  112.         public Builder(final QZSSOrbitalElements qzssOrbElt,
  113.                        final Frames frames) {
  114.             this.orbit = qzssOrbElt;
  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 assimilated to the WGS84 ECEF.
  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 QZSSPropagator
  158.          */
  159.         public QZSSPropagator build() {
  160.             return new QZSSPropagator(this);
  161.         }
  162.     }

  163.     /**
  164.      * Private constructor.
  165.      *
  166.      * @param builder the builder
  167.      */
  168.     private QZSSPropagator(final Builder builder) {
  169.         super(builder.orbit, builder.attitudeProvider,
  170.               builder.eci, builder.ecef, builder.mass,
  171.               QZSS_AV, QZSS_CYCLE_DURATION, QZSSOrbitalElements.QZSS_MU);
  172.         // Stores the QZSS orbital elements
  173.         this.qzssOrbit = builder.orbit;
  174.     }

  175.     /**
  176.      * Gets the underlying QZSS orbital elements.
  177.      *
  178.      * @return the underlying QZSS orbital elements
  179.      */
  180.     public QZSSOrbitalElements getQZSSOrbitalElements() {
  181.         return qzssOrbit;
  182.     }

  183. }