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