SBASPropagatorBuilder.java

  1. /* Copyright 2002-2022 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.propagation.Propagator;
  23. import org.orekit.propagation.analytical.gnss.data.GNSSConstants;
  24. import org.orekit.propagation.analytical.gnss.data.SBASOrbitalElements;
  25. import org.orekit.utils.IERSConventions;

  26. /**
  27.  * This nested class aims at building a SBASPropagator.
  28.  * <p>It implements the classical builder pattern.</p>
  29.  * @since 11.0
  30.  * @author Bryan Cazabonne
  31.  */
  32. public class SBASPropagatorBuilder {

  33.     /** The SBAS orbital elements. */
  34.     private final SBASOrbitalElements orbit;

  35.     /** The Earth gravity coefficient used for SBAS propagation. */
  36.     private double mu;

  37.     /** The attitude provider. */
  38.     private AttitudeProvider attitudeProvider;

  39.     /** The mass. */
  40.     private double mass;

  41.     /** The ECI frame. */
  42.     private Frame eci;

  43.     /** The ECEF frame. */
  44.     private Frame ecef;

  45.     /** Initializes the builder.
  46.      * <p>The SBAS orbital elements is the only requested parameter to build a SBASPropagator.</p>
  47.      * <p>The attitude provider is set by default be aligned with the EME2000 frame.<br>
  48.      * The Earth gravity coefficient is set by default to the
  49.      *  {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
  50.      * The mass is set by default to the
  51.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  52.      * The ECI frame is set by default to the
  53.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
  54.      * The ECEF frame is set by default to the
  55.      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
  56.      * </p>
  57.      *
  58.      * @param sbasOrbElt the SBAS orbital elements to be used by the SBAS propagator.
  59.      * @param frames     set of reference frames to use to initialize {@link
  60.      *                   #ecef(Frame)}, {@link #eci(Frame)}, and {@link
  61.      *                   #attitudeProvider(AttitudeProvider)}.
  62.      * @see #attitudeProvider(AttitudeProvider provider)
  63.      * @see #mu(double coefficient)
  64.      * @see #mass(double mass)
  65.      * @see #eci(Frame inertial)
  66.      * @see #ecef(Frame bodyFixed)
  67.      */
  68.     public SBASPropagatorBuilder(final SBASOrbitalElements sbasOrbElt, final Frames frames) {
  69.         this.orbit = sbasOrbElt;
  70.         this.mass  = Propagator.DEFAULT_MASS;
  71.         this.eci   = frames.getEME2000();
  72.         this.ecef  = frames.getITRF(IERSConventions.IERS_2010, true);
  73.         this.mu    = GNSSConstants.SBAS_MU;
  74.         this.attitudeProvider = new InertialProvider(eci);
  75.     }

  76.     /** Sets the attitude provider.
  77.      *
  78.      * @param userProvider the attitude provider
  79.      * @return the updated builder
  80.      */
  81.     public SBASPropagatorBuilder attitudeProvider(final AttitudeProvider userProvider) {
  82.         this.attitudeProvider = userProvider;
  83.         return this;
  84.     }

  85.     /** Sets the Earth gravity coefficient.
  86.     *
  87.     * @param coefficient the Earth gravity coefficient
  88.     * @return the updated builder
  89.     */
  90.     public SBASPropagatorBuilder mu(final double coefficient) {
  91.         this.mu = coefficient;
  92.         return this;
  93.     }

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

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

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

  121.     /** Finalizes the build.
  122.      *
  123.      * @return the built SBASPropagator
  124.      */
  125.     public SBASPropagator build() {
  126.         return new SBASPropagator(orbit, eci, ecef, attitudeProvider, mass, mu);
  127.     }

  128. }