GLONASSNumericalPropagatorBuilder.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.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.InertialProvider;
  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.GLONASSOrbitalElements;

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

  33.     //////////
  34.     // Required parameter
  35.     //////////

  36.     /** The GLONASS orbital elements. */
  37.     private final GLONASSOrbitalElements orbit;

  38.     /** The 4th order Runge-Kutta integrator. */
  39.     private final ClassicalRungeKuttaIntegrator integrator;

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

  42.     ///////////
  43.     // Optional parameters
  44.     //////////

  45.     /** The attitude provider. */
  46.     private AttitudeProvider attitudeProvider;

  47.     /** The mass. */
  48.     private double mass;

  49.     /** The ECI frame. */
  50.     private Frame eci;

  51.     /** Data context for the propagator. */
  52.     private DataContext dataContext;

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


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

  112.     /**
  113.      * Sets the attitude provider.
  114.      *
  115.      * @param userProvider the attitude provider
  116.      * @return the updated builder
  117.      */
  118.     public GLONASSNumericalPropagatorBuilder attitudeProvider(final AttitudeProvider userProvider) {
  119.         this.attitudeProvider = userProvider;
  120.         return this;
  121.     }

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

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

  142.     /**
  143.      * Finalizes the build.
  144.      *
  145.      * @return the built Glonass numerical propagator
  146.      */
  147.     public GLONASSNumericalPropagator build() {
  148.         return new GLONASSNumericalPropagator(integrator, orbit, eci, attitudeProvider,
  149.                                               mass, dataContext, isAccAvailable);
  150.     }

  151. }