FieldAbstractAlmanac.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.data;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;
  20. import org.orekit.annotation.DefaultDataContext;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.data.DataContext;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.frames.Frames;
  25. import org.orekit.propagation.analytical.gnss.FieldGnssPropagator;
  26. import org.orekit.propagation.analytical.gnss.FieldGnssPropagatorBuilder;

  27. import java.util.function.Function;

  28. /**
  29.  * Base class for GNSS almanacs.
  30.  * @param <T> type of the field elements
  31.  * @param <O> type of the orbital elements (non-field version)
  32.  * @author Luc Maisonobe
  33.  * @since 13.0
  34.  */
  35. public abstract class FieldAbstractAlmanac<T extends CalculusFieldElement<T>,
  36.                                            O extends AbstractAlmanac<O>>
  37.     extends FieldCommonGnssData<T, O> {

  38.     /** Constructor from non-field instance.
  39.      * @param field    field to which elements belong
  40.      * @param original regular non-field instance
  41.      */
  42.     protected FieldAbstractAlmanac(final Field<T> field, final O original) {
  43.         super(field, original);
  44.     }

  45.     /** Constructor from different field instance.
  46.      * @param <V> type of the old field elements
  47.      * @param original regular non-field instance
  48.      * @param converter for field elements
  49.      */
  50.     protected <V extends CalculusFieldElement<V>> FieldAbstractAlmanac(final Function<V, T> converter,
  51.                                                                        final FieldAbstractAlmanac<V, O> original) {
  52.         super(converter, original);
  53.     }

  54.     /**
  55.      * Get the propagator corresponding to the navigation message.
  56.      * <p>
  57.      * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
  58.      * The mass is set by default to the
  59.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  60.      * The ECI frame is set by default to the
  61.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
  62.      *  context.<br>
  63.      * The ECEF frame is set by default to the
  64.      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
  65.      *  CIO/2010-based ITRF simple EOP} in the default data context.
  66.      * </p><p>
  67.      * This constructor uses the {@link DataContext#getDefault() default data context}
  68.      * </p>
  69.      * @return the propagator corresponding to the navigation message
  70.      * @see #getPropagator(Frames)
  71.      * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, CalculusFieldElement)
  72.      */
  73.     @DefaultDataContext
  74.     public FieldGnssPropagator<T> getPropagator() {
  75.         return new FieldGnssPropagatorBuilder<>(this).build();
  76.     }

  77.     /**
  78.      * Get the propagator corresponding to the navigation message.
  79.      * <p>
  80.      * The attitude provider is set by default to be aligned with the EME2000 frame.<br>
  81.      * The mass is set by default to the
  82.      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
  83.      * The ECI frame is set by default to the
  84.      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame} in the default data
  85.      *  context.<br>
  86.      * The ECEF frame is set by default to the
  87.      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP
  88.      *  CIO/2010-based ITRF simple EOP} in the default data context.
  89.      * </p>
  90.      * @param frames set of frames to use
  91.      * @return the propagator corresponding to the navigation message
  92.      * @see #getPropagator()
  93.      * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, CalculusFieldElement)
  94.      */
  95.     public FieldGnssPropagator<T> getPropagator(final Frames frames) {
  96.         return new FieldGnssPropagatorBuilder<>(this, frames).build();
  97.     }

  98.     /**
  99.      * Get the propagator corresponding to the navigation message.
  100.      * @param frames set of frames to use
  101.      * @param provider attitude provider
  102.      * @param inertial inertial frame, use to provide the propagated orbit
  103.      * @param bodyFixed body fixed frame, corresponding to the navigation message
  104.      * @param mass spacecraft mass in kg
  105.      * @return the propagator corresponding to the navigation message
  106.      * @see #getPropagator()
  107.      * @see #getPropagator(Frames)
  108.      */
  109.     public FieldGnssPropagator<T> getPropagator(final Frames frames, final AttitudeProvider provider,
  110.                                                 final Frame inertial, final Frame bodyFixed, final T mass) {
  111.         return new FieldGnssPropagatorBuilder<>(this, frames).
  112.                attitudeProvider(provider).
  113.                eci(inertial).
  114.                ecef(bodyFixed).
  115.                mass(mass).
  116.                build();
  117.     }

  118. }