GLONASSNumericalPropagatorBuilder.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.numerical;

  18. import org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator;
  19. import org.orekit.annotation.DefaultDataContext;
  20. import org.orekit.attitudes.AttitudeProvider;
  21. import org.orekit.attitudes.FrameAlignedProvider;
  22. import org.orekit.data.DataContext;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.propagation.Propagator;
  25. import org.orekit.propagation.analytical.gnss.data.GLONASSAlmanac;
  26. import org.orekit.propagation.analytical.gnss.data.GLONASSNavigationMessage;
  27. import org.orekit.propagation.analytical.gnss.data.GLONASSOrbitalElements;

  28. /**
  29.  * This nested class aims at building a GLONASSNumericalPropagator.
  30.  * <p>It implements the classical builder pattern.</p>
  31.  * <p>
  32.  * <b>Caution:</b> The Glonass numerical propagator can only be used with {@link GLONASSNavigationMessage}.
  33.  * Using this propagator with a {@link GLONASSAlmanac} is prone to error.
  34.  * </p>
  35.  * @author Bryan Cazabonne
  36.  * @since 11.0
  37.  */
  38. public class GLONASSNumericalPropagatorBuilder {

  39.     //////////
  40.     // Required parameter
  41.     //////////

  42.     /** The GLONASS orbital elements. */
  43.     private final GLONASSOrbitalElements orbit;

  44.     /** The 4th order Runge-Kutta integrator. */
  45.     private final ClassicalRungeKuttaIntegrator integrator;

  46.     /** Flag for availability of projections of acceleration transmitted within the navigation message. */
  47.     private final boolean isAccAvailable;

  48.     ///////////
  49.     // Optional parameters
  50.     //////////

  51.     /** The attitude provider. */
  52.     private AttitudeProvider attitudeProvider;

  53.     /** The mass. */
  54.     private double mass;

  55.     /** The ECI frame. */
  56.     private Frame eci;

  57.     /** Data context for the propagator. */
  58.     private DataContext dataContext;

  59.     /**
  60.      * Initializes the builder.
  61.      * <p>The attitude provider is set by default to EME2000 aligned in the
  62.      *  default data context.<br>
  63.      * The mass is set by default to the
  64.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  65.      * The data context is by default to the
  66.      *  {@link DataContext#getDefault() default data context}.<br>
  67.      * The ECI frame is set by default to the
  68.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
  69.      *  context.<br>
  70.      * </p>
  71.      *
  72.      * @param integrator 4th order Runge-Kutta as recommended by GLONASS ICD
  73.      * @param glonassOrbElt the GLONASS orbital elements to be used by the GLONASSNumericalPropagator.
  74.      * @param isAccAvailable flag for availability of the projections of accelerations transmitted within
  75.      *        the navigation message
  76.      * @see #attitudeProvider(AttitudeProvider provider)
  77.      * @see #mass(double mass)
  78.      * @see #eci(Frame inertial)
  79.      */
  80.     @DefaultDataContext
  81.     public GLONASSNumericalPropagatorBuilder(final ClassicalRungeKuttaIntegrator integrator,
  82.                                              final GLONASSOrbitalElements glonassOrbElt,
  83.                                              final boolean isAccAvailable) {
  84.         this(integrator, glonassOrbElt, isAccAvailable, DataContext.getDefault());
  85.     }


  86.     /**
  87.      * Initializes the builder.
  88.      * <p>The attitude provider is set by default to EME2000 aligned in the
  89.      *  provided data context.<br>
  90.      * The mass is set by default to the
  91.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  92.      * The ECI frame is set by default to the
  93.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
  94.      *  context.<br>
  95.      * </p>
  96.      *
  97.      * @param integrator 4th order Runge-Kutta as recommended by GLONASS ICD
  98.      * @param glonassOrbElt the GLONASS orbital elements to be used by the GLONASSNumericalPropagator.
  99.      * @param isAccAvailable flag for availability of the projections of accelerations transmitted within
  100.      *        the navigation message
  101.      * @param context data context
  102.      * @see #attitudeProvider(AttitudeProvider provider)
  103.      * @see #mass(double mass)
  104.      * @see #eci(Frame inertial)
  105.      */
  106.     public GLONASSNumericalPropagatorBuilder(final ClassicalRungeKuttaIntegrator integrator,
  107.                                              final GLONASSOrbitalElements glonassOrbElt,
  108.                                              final boolean isAccAvailable,
  109.                                              final DataContext context) {
  110.         this.isAccAvailable   = isAccAvailable;
  111.         this.integrator       = integrator;
  112.         this.orbit            = glonassOrbElt;
  113.         this.mass             = Propagator.DEFAULT_MASS;
  114.         this.dataContext      = context;
  115.         this.eci              = dataContext.getFrames().getEME2000();
  116.         this.attitudeProvider = FrameAlignedProvider.of(this.eci);
  117.     }

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

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

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

  148.     /**
  149.      * Finalizes the build.
  150.      *
  151.      * @return the built Glonass numerical propagator
  152.      */
  153.     public GLONASSNumericalPropagator build() {
  154.         return new GLONASSNumericalPropagator(integrator, orbit, eci, attitudeProvider,
  155.                                               mass, dataContext, isAccAvailable);
  156.     }

  157. }