IsotropicRadiationSingleCoefficient.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.forces.radiation;

  18. import java.util.ArrayList;
  19. import java.util.Collections;
  20. import java.util.List;

  21. import org.hipparchus.CalculusFieldElement;
  22. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  23. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  24. import org.hipparchus.util.FastMath;
  25. import org.orekit.propagation.FieldSpacecraftState;
  26. import org.orekit.propagation.SpacecraftState;
  27. import org.orekit.utils.ParameterDriver;

  28. /** This class represents the features of a simplified spacecraft.
  29.  * <p>This model uses a single coefficient cr, considered to be
  30.  * a {@link RadiationSensitive#REFLECTION_COEFFICIENT}.
  31.  * </p>
  32.  *
  33.  * @see org.orekit.forces.BoxAndSolarArraySpacecraft
  34.  * @see org.orekit.forces.drag.IsotropicDrag
  35.  * @see IsotropicRadiationCNES95Convention
  36.  * @author Luc Maisonobe
  37.  * @since 7.1
  38.  */
  39. public class IsotropicRadiationSingleCoefficient implements RadiationSensitive {

  40.     /** Parameters scaling factor.
  41.      * <p>
  42.      * We use a power of 2 to avoid numeric noise introduction
  43.      * in the multiplications/divisions sequences.
  44.      * </p>
  45.      */
  46.     private final double SCALE = FastMath.scalb(1.0, -3);

  47.     /** Drivers for radiation coefficient. */
  48.     private final List<ParameterDriver> radiationParametersDrivers;

  49.     /** Cross section (m²). */
  50.     private final double crossSection;

  51.     /** Constructor with reflection coefficient min/max set to ±∞.
  52.      * @param crossSection Surface (m²)
  53.      * @param cr reflection coefficient
  54.      */
  55.     public IsotropicRadiationSingleCoefficient(final double crossSection, final double cr) {
  56.         this(crossSection, cr, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  57.     }

  58.     /** Constructor with reflection coefficient min/max set by user.
  59.     * @param crossSection Surface (m²)
  60.     * @param cr reflection coefficient
  61.     * @param crMin Minimum value of reflection coefficient
  62.     * @param crMax Maximum value of reflection coefficient
  63.     */
  64.     public IsotropicRadiationSingleCoefficient(final double crossSection, final double cr,
  65.                                                final double crMin, final double crMax) {
  66.         // in some corner cases (unknown spacecraft, fuel leaks, active piloting ...)
  67.         // the single coefficient may be arbitrary, and even negative
  68.         // the REFLECTION_COEFFICIENT parameter should be sufficient, but GLOBAL_RADIATION_FACTOR
  69.         // was added as of 12.0 for consistency with BoxAndSolarArraySpacecraft
  70.         // that only has a global multiplicatof factor, hence allowing this name
  71.         // to be used for both models
  72.         this.radiationParametersDrivers = new ArrayList<>(2);
  73.         radiationParametersDrivers.add(new ParameterDriver(RadiationSensitive.GLOBAL_RADIATION_FACTOR,
  74.                                                            1.0, SCALE,
  75.                                                            0.0, Double.POSITIVE_INFINITY));
  76.         radiationParametersDrivers.add(new ParameterDriver(RadiationSensitive.REFLECTION_COEFFICIENT,
  77.                                                            cr, SCALE,
  78.                                                            crMin, crMax));

  79.         this.crossSection = crossSection;

  80.     }

  81.     /** {@inheritDoc} */
  82.     @Override
  83.     public List<ParameterDriver> getRadiationParametersDrivers() {
  84.         return Collections.unmodifiableList(radiationParametersDrivers);
  85.     }

  86.     /** {@inheritDoc} */
  87.     @Override
  88.     public Vector3D radiationPressureAcceleration(final SpacecraftState state, final Vector3D flux,
  89.                                                   final double[] parameters) {
  90.         final double cr = parameters[1];
  91.         return new Vector3D(parameters[0] * crossSection * cr / state.getMass(), flux);
  92.     }

  93.     /** {@inheritDoc} */
  94.     @Override
  95.     public <T extends CalculusFieldElement<T>> FieldVector3D<T>
  96.         radiationPressureAcceleration(final FieldSpacecraftState<T> state,
  97.                                       final FieldVector3D<T> flux,
  98.                                       final T[] parameters) {
  99.         final T cr = parameters[1];
  100.         return new FieldVector3D<>(state.getMass().reciprocal().multiply(parameters[0]).multiply(crossSection).multiply(cr),
  101.                                    flux);

  102.     }
  103. }