EventDetectionSettings.java

  1. /* Copyright 2022-2024 Romain Serra
  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.events;

  18. /**
  19.  * Class containing parameters for event detection.
  20.  *
  21.  * @author Romain Serra.
  22.  * @since 12.2
  23.  * @see EventDetector
  24.  */
  25. public class EventDetectionSettings {

  26.     /** Default maximum checking interval (s). */
  27.     public static final double DEFAULT_MAXCHECK = 600;

  28.     /** Default convergence threshold (s). */
  29.     public static final double DEFAULT_THRESHOLD = 1.e-6;

  30.     /** Default maximum number of iterations in the event time search. */
  31.     public static final int DEFAULT_MAX_ITER = 100;

  32.     /** Adaptable interval for maximum time without event evaluation. */
  33.     private final AdaptableInterval maxCheckInterval;

  34.     /** Detection threshold. */
  35.     private final double threshold;

  36.     /** Maximum iteration number when detecting event. */
  37.     private final int maxIterationCount;

  38.     /**
  39.      * Constructor.
  40.      *
  41.      * @param maxCheckInterval  adaptable interval
  42.      * @param threshold         detection threshold on time
  43.      * @param maxIterationCount maximum iteration number
  44.      */
  45.     public EventDetectionSettings(final AdaptableInterval maxCheckInterval, final double threshold,
  46.                                   final int maxIterationCount) {
  47.         this.maxCheckInterval = maxCheckInterval;
  48.         this.maxIterationCount = maxIterationCount;
  49.         this.threshold = threshold;
  50.     }

  51.     /**
  52.      * Constructor with maximum check as double.
  53.      *
  54.      * @param maxCheck          constant maximum check for adaptable interval
  55.      * @param threshold         detection threshold on time
  56.      * @param maxIterationCount maximum iteration number
  57.      */
  58.     public EventDetectionSettings(final double maxCheck, final double threshold, final int maxIterationCount) {
  59.         this(AdaptableInterval.of(maxCheck), threshold, maxIterationCount);
  60.     }

  61.     /**
  62.      * Getter for adaptable interval.
  63.      * @return adaptable interval
  64.      */
  65.     public AdaptableInterval getMaxCheckInterval() {
  66.         return maxCheckInterval;
  67.     }

  68.     /**
  69.      * Getter for threshold.
  70.      * @return threshold
  71.      */
  72.     public double getThreshold() {
  73.         return threshold;
  74.     }

  75.     /**
  76.      * Getter for max iter.
  77.      * @return max iter
  78.      */
  79.     public int getMaxIterationCount() {
  80.         return maxIterationCount;
  81.     }

  82.     /**
  83.      * Returns default settings for event detections.
  84.      * @return default settings
  85.      */
  86.     public static EventDetectionSettings getDefaultEventDetectionSettings() {
  87.         return new EventDetectionSettings(DEFAULT_MAXCHECK, DEFAULT_THRESHOLD, DEFAULT_MAX_ITER);
  88.     }
  89. }