1   /* Copyright 2020 Exotrail
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    * Exotrail 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.maneuvers;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.forces.maneuvers.propulsion.AbstractConstantThrustPropulsionModel;
21  import org.orekit.forces.maneuvers.propulsion.BasicConstantThrustPropulsionModel;
22  import org.orekit.forces.maneuvers.propulsion.ThrustDirectionAndAttitudeProvider;
23  import org.orekit.forces.maneuvers.trigger.EventBasedManeuverTriggers;
24  import org.orekit.propagation.events.AbstractDetector;
25  import org.orekit.propagation.events.EventDetector;
26  
27  /**
28   * This class implements a configurable low thrust maneuver.
29   * <p>
30   * The maneuver is composed of succession of a burn interval. Burn intervals are
31   * defined by two detectors. See
32   * {@link org.orekit.forces.maneuvers.trigger.EventBasedManeuverTriggers
33   * EventBasedManeuverTriggers} for more details on the detectors. The attitude
34   * and the thrust direction are provided by an instance of
35   * ThrustDirectionProvider See
36   * {@link org.orekit.forces.maneuvers.propulsion.ThrustDirectionAndAttitudeProvider
37   * ThrustDirectionProvider} for more details on thrust direction and attitude.
38   * @author Mikael Fillastre
39   * @author Andrea Fiorentino
40   * @since 10.2
41   */
42  
43  public class ConfigurableLowThrustManeuver extends Maneuver {
44  
45      /** To be used for ParameterDriver to make thrust non constant. */
46      private static String THRUST_MODEL_IDENTIFIER = "ConfigurableLowThrustManeuver";
47  
48      /** Thrust direction and spaceraft attitude provided by an external object. */
49      private final ThrustDirectionAndAttitudeProvider thrustDirectionProvider;
50  
51      /**
52       * Constructor. See
53       * {@link org.orekit.forces.maneuvers.trigger.EventBasedManeuverTriggers
54       * EventBasedManeuverTriggers} for requirements on detectors
55       * @param thrustDirectionProvider thrust direction and attitude provider
56       * @param startFiringDetector     detector to start thrusting (start when
57       *                                increasing)
58       * @param stopFiringDetector      detector to stop thrusting (stop when
59       *                                increasing)
60       * @param thrust                  the thrust force (N)
61       * @param isp                     engine specific impulse (s)
62       */
63      public ConfigurableLowThrustManeuver(final ThrustDirectionAndAttitudeProvider thrustDirectionProvider,
64              final AbstractDetector<? extends EventDetector> startFiringDetector,
65              final AbstractDetector<? extends EventDetector> stopFiringDetector, final double thrust, final double isp) {
66          super(thrustDirectionProvider.getManeuverAttitudeProvider(),
67                  new EventBasedManeuverTriggers(startFiringDetector, stopFiringDetector),
68                  buildBasicConstantThrustPropulsionModel(thrust, isp,
69                          thrustDirectionProvider.getThrusterAxisInSatelliteFrame()));
70          this.thrustDirectionProvider = thrustDirectionProvider;
71  
72      }
73  
74      /**
75       * Build a BasicConstantThrustPropulsionModel from thruster characteristics.
76       * @param thrust                       the thrust force (N)
77       * @param isp                          engine specific impulse (s)
78       * @param thrusterAxisInSatelliteFrame direction in spacecraft frame
79       * @return new instance of BasicConstantThrustPropulsionModel
80       */
81      private static BasicConstantThrustPropulsionModel buildBasicConstantThrustPropulsionModel(final double thrust,
82              final double isp, final Vector3D thrusterAxisInSatelliteFrame) {
83          return new BasicConstantThrustPropulsionModel(thrust, isp, thrusterAxisInSatelliteFrame,
84                  THRUST_MODEL_IDENTIFIER);
85      }
86  
87      /**
88       * Getter on Thrust direction and spaceraft attitude provided by an external
89       * object.
90       * @return internal field
91       */
92      public ThrustDirectionAndAttitudeProvider getThrustDirectionProvider() {
93          return thrustDirectionProvider;
94      }
95  
96      /**
97       * Get the thrust.
98       *
99       * @return thrust force (N).
100      */
101     public double getThrust() {
102         return ((AbstractConstantThrustPropulsionModel) (getPropulsionModel())).getThrustVector().getNorm();
103     }
104 
105     /**
106      * Get the specific impulse.
107      *
108      * @return specific impulse (s).
109      */
110     public double getISP() {
111         return ((AbstractConstantThrustPropulsionModel) (getPropulsionModel())).getIsp();
112     }
113 
114 }