Chan1997.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.ssa.collision.shorttermencounter.probability.twod;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;
  20. import org.hipparchus.util.FastMath;
  21. import org.hipparchus.util.MathArrays;
  22. import org.orekit.ssa.metrics.FieldProbabilityOfCollision;
  23. import org.orekit.ssa.metrics.ProbabilityOfCollision;

  24. /**
  25.  * Compute the probability of collision using the method described in : <br> "Chan, K. “Collision Probability Analyses for
  26.  * Earth Orbiting Satellites.” In Space Cooperation into the 21st Century: 7th AAS/JRS/CSA Symposium, International Space
  27.  * Conference of Pacific-Basin Societies (ISCOPS; formerly PISSTA) (July 15-18, 1997, Nagasaki, Japan), edited by Peter M.
  28.  * Bainum, et al., 1033-1048. Advances in the Astronautical Sciences Series 96. San Diego, California: Univelt, 1997. (Zeroth
  29.  * order analytical expression).
  30.  * <p>
  31.  * This method is also described in depth in : "CHAN, F. Kenneth, et al. Spacecraft collision probability. El Segundo, CA :
  32.  * Aerospace Press, 2008."
  33.  * <p>
  34.  * It assumes :
  35.  * <ul>
  36.  *     <li>Short encounter leading to a linear relative motion.</li>
  37.  *     <li>Spherical collision object.</li>
  38.  *     <li>Uncorrelated positional covariance.</li>
  39.  *     <li>Gaussian distribution of the position uncertainties.</li>
  40.  *     <li>Deterministic velocity i.e. no velocity uncertainties.</li>
  41.  *     <li>Approximate ellipse by a disk</li>
  42.  * </ul>
  43.  *
  44.  * @author Vincent Cucchietti
  45.  * @since 12.0
  46.  */
  47. public class Chan1997 extends AbstractShortTermEncounter2DPOCMethod {

  48.     /** Empty constructor. */
  49.     public Chan1997() {
  50.         super(ShortTermEncounter2DPOCMethodType.CHAN_1997.name());
  51.     }

  52.     /** {@inheritDoc} */
  53.     public ProbabilityOfCollision compute(final double xm, final double ym,
  54.                                           final double sigmaX, final double sigmaY,
  55.                                           final double radius) {

  56.         // Intermediary terms u and v
  57.         final double u = radius * radius / (sigmaX * sigmaY);
  58.         final double v = (xm * xm / (sigmaX * sigmaX)) + (ym * ym / (sigmaY * sigmaY));

  59.         // Number of terms M recommended by Chan
  60.         final int M;

  61.         if (u <= 0.01 || v <= 1) {
  62.             M = 3;
  63.         } else if (u > 0.01 && u <= 1 || v > 1 && v <= 9) {
  64.             M = 10;
  65.         } else if (u > 1 && u <= 25 || v > 9 && v <= 25) {
  66.             M = 20;
  67.         } else {
  68.             M = 60;
  69.         }

  70.         double t   = 1.0;
  71.         double s   = 1.0;
  72.         double sum = 1.0;

  73.         // first iteration
  74.         double value = FastMath.exp(-v * 0.5) * t - FastMath.exp(-(u + v) * 0.5) * t * sum;

  75.         // iterative expression
  76.         for (int i = 1; i < M; i++) {
  77.             t     = (v * 0.5) / i * t;
  78.             s     = (u * 0.5) / i * s;
  79.             sum   = sum + s;
  80.             value = MathArrays.linearCombination(1, value, FastMath.exp(-v * 0.5), t) -
  81.                     FastMath.exp(-(u + v) * 0.5) * t * sum;
  82.         }

  83.         return new ProbabilityOfCollision(value, getName(), isAMaximumProbabilityOfCollisionMethod());
  84.     }

  85.     /** {@inheritDoc} */
  86.     public <T extends CalculusFieldElement<T>> FieldProbabilityOfCollision<T> compute(final T xm, final T ym,
  87.                                                                                       final T sigmaX, final T sigmaY,
  88.                                                                                       final T radius) {

  89.         // Intermediary terms u and v
  90.         final T u = radius.pow(2).divide(sigmaX.multiply(sigmaY));
  91.         final T v = xm.divide(sigmaX).pow(2).add(ym.divide(sigmaY).pow(2));

  92.         // Number of terms M recommended by Chan
  93.         final int M;

  94.         if (u.getReal() <= 0.01 || v.getReal() <= 1) {
  95.             M = 3;
  96.         } else if (u.getReal() > 0.01 && u.getReal() <= 1 || v.getReal() > 1 && v.getReal() <= 9) {
  97.             M = 10;
  98.         } else if (u.getReal() > 1 && u.getReal() <= 25 || v.getReal() > 9 && v.getReal() <= 25) {
  99.             M = 20;
  100.         } else {
  101.             M = 60;
  102.         }

  103.         final Field<T> field = radius.getField();

  104.         T t   = field.getOne();
  105.         T s   = field.getOne();
  106.         T sum = field.getOne();

  107.         // first iteration
  108.         T value = v.multiply(-0.5).exp().multiply(t)
  109.                    .subtract(u.add(v).multiply(-0.5).exp().multiply(t).multiply(sum));

  110.         // iterative expression
  111.         for (int i = 1; i < M; i++) {
  112.             t   = v.multiply(0.5).divide(i).multiply(t);
  113.             s   = u.multiply(0.5).divide(i).multiply(s);
  114.             sum = sum.add(s);

  115.             value = value.add(v.multiply(-0.5).exp().multiply(t)
  116.                                .subtract(u.add(v).multiply(-0.5).exp().multiply(t).multiply(sum)));
  117.         }

  118.         return new FieldProbabilityOfCollision<>(value, getName(), isAMaximumProbabilityOfCollisionMethod());
  119.     }

  120.     /** {@inheritDoc} */
  121.     @Override
  122.     public ShortTermEncounter2DPOCMethodType getType() {
  123.         return ShortTermEncounter2DPOCMethodType.CHAN_1997;
  124.     }

  125. }