SBASPropagatorBuilder.java

  1. /* Copyright 2002-2024 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.attitudes.FrameAlignedProvider;
  21. import org.orekit.data.DataContext;
  22. import org.orekit.frames.Frame;
  23. import org.orekit.frames.Frames;
  24. import org.orekit.propagation.Propagator;
  25. import org.orekit.propagation.analytical.gnss.data.GNSSConstants;
  26. import org.orekit.propagation.analytical.gnss.data.SBASOrbitalElements;
  27. import org.orekit.utils.IERSConventions;

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

  35.     /** The SBAS orbital elements. */
  36.     private final SBASOrbitalElements orbit;

  37.     /** The Earth gravity coefficient used for SBAS propagation. */
  38.     private double mu;

  39.     /** The attitude provider. */
  40.     private AttitudeProvider attitudeProvider;

  41.     /** The mass. */
  42.     private double mass;

  43.     /** The ECI frame. */
  44.     private Frame eci;

  45.     /** The ECEF frame. */
  46.     private Frame ecef;

  47.     /** Initializes the builder.
  48.      * <p>The SBAS orbital elements is the only requested parameter to build a SBASPropagator.</p>
  49.      * <p>The attitude provider is set by default be aligned with the EME2000 frame.<br>
  50.      * The Earth gravity coefficient is set by default to the
  51.      *  {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
  52.      * The mass is set by default to the
  53.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  54.      * The ECI frame is set by default to the
  55.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
  56.      * The ECEF frame is set by default to the
  57.      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
  58.      * </p>
  59.      * <p>This constructor uses the {@link DataContext#getDefault() default data context}.</p>
  60.      *
  61.      * @param sbasOrbElt the SBAS orbital elements to be used by the SBAS propagator.
  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.      * @since 12.0
  68.      */
  69.     @DefaultDataContext
  70.     public SBASPropagatorBuilder(final SBASOrbitalElements sbasOrbElt) {
  71.         this(sbasOrbElt, DataContext.getDefault().getFrames());
  72.     }

  73.     /** Initializes the builder.
  74.      * <p>The SBAS orbital elements is the only requested parameter to build a SBASPropagator.</p>
  75.      * <p>The attitude provider is set by default to be aligned with the EME2000 frame.<br>
  76.      * The Earth gravity coefficient is set by default to the
  77.      *  {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
  78.      * The mass is set by default to the
  79.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  80.      * The ECI frame is set by default to the
  81.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
  82.      * The ECEF frame is set by default to the
  83.      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
  84.      * </p>
  85.      *
  86.      * @param sbasOrbElt the SBAS orbital elements to be used by the SBAS propagator.
  87.      * @param frames     set of reference frames to use to initialize {@link
  88.      *                   #ecef(Frame)}, {@link #eci(Frame)}, and {@link
  89.      *                   #attitudeProvider(AttitudeProvider)}.
  90.      * @see #attitudeProvider(AttitudeProvider provider)
  91.      * @see #mu(double coefficient)
  92.      * @see #mass(double mass)
  93.      * @see #eci(Frame inertial)
  94.      * @see #ecef(Frame bodyFixed)
  95.      */
  96.     public SBASPropagatorBuilder(final SBASOrbitalElements sbasOrbElt, final Frames frames) {
  97.         this.orbit            = sbasOrbElt;
  98.         this.mass             = Propagator.DEFAULT_MASS;
  99.         this.eci              = frames.getEME2000();
  100.         this.ecef             = frames.getITRF(IERSConventions.IERS_2010, true);
  101.         this.mu               = GNSSConstants.SBAS_MU;
  102.         this.attitudeProvider = new FrameAlignedProvider(eci);
  103.     }

  104.     /** Sets the attitude provider.
  105.      *
  106.      * @param userProvider the attitude provider
  107.      * @return the updated builder
  108.      */
  109.     public SBASPropagatorBuilder attitudeProvider(final AttitudeProvider userProvider) {
  110.         this.attitudeProvider = userProvider;
  111.         return this;
  112.     }

  113.     /** Sets the Earth gravity coefficient.
  114.     *
  115.     * @param coefficient the Earth gravity coefficient
  116.     * @return the updated builder
  117.     */
  118.     public SBASPropagatorBuilder mu(final double coefficient) {
  119.         this.mu = coefficient;
  120.         return this;
  121.     }

  122.     /** Sets the mass.
  123.      *
  124.      * @param userMass the mass (in kg)
  125.      * @return the updated builder
  126.      */
  127.     public SBASPropagatorBuilder mass(final double userMass) {
  128.         this.mass = userMass;
  129.         return this;
  130.     }

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

  140.     /** Sets the Earth Centered Earth Fixed frame assimilated to the WGS84 ECEF.
  141.      *
  142.      * @param bodyFixed the ECEF frame
  143.      * @return the updated builder
  144.      */
  145.     public SBASPropagatorBuilder ecef(final Frame bodyFixed) {
  146.         this.ecef = bodyFixed;
  147.         return this;
  148.     }

  149.     /** Finalizes the build.
  150.      *
  151.      * @return the built SBASPropagator
  152.      */
  153.     public SBASPropagator build() {
  154.         return new SBASPropagator(orbit, eci, ecef, attitudeProvider, mass, mu);
  155.     }

  156. }