Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alberto Fossà
Orekit
Commits
bcfe9b8a
Commit
bcfe9b8a
authored
Jan 10, 2022
by
Luc Maisonobe
Browse files
Started refactoring of CR3BP for partial derivatives computation.
parent
65e649c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/orekit/propagation/numerical/cr3bp/CR3BPMultipleShooter.java
View file @
bcfe9b8a
...
...
@@ -18,9 +18,9 @@ package org.orekit.propagation.numerical.cr3bp;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.orekit.propagation.SpacecraftState
;
import
org.orekit.propagation.integration.AdditionalDerivativesProvider
;
import
org.orekit.propagation.numerical.NumericalPropagator
;
import
org.orekit.utils.AbsolutePVCoordinates
;
import
org.orekit.utils.AbstractMultipleShooting
;
...
...
@@ -35,6 +35,11 @@ public class CR3BPMultipleShooter extends AbstractMultipleShooting {
/** Name of the derivatives. */
private
static
final
String
STM
=
"stmEquations"
;
/** Derivatives linked to the Propagators.
* @since 11.1
*/
private
final
List
<
STMEquations
>
stmEquations
;
/** Number of patch points. */
private
int
npoints
;
...
...
@@ -52,7 +57,8 @@ public class CR3BPMultipleShooter extends AbstractMultipleShooting {
final
List
<
org
.
orekit
.
propagation
.
integration
.
AdditionalEquations
>
additionalEquations
,
final
double
arcDuration
,
final
double
tolerance
)
{
super
(
initialGuessList
,
propagatorList
,
additionalEquations
,
arcDuration
,
tolerance
,
STM
);
this
.
npoints
=
initialGuessList
.
size
();
stmEquations
=
additionalEquations
.
stream
().
map
(
ae
->
(
STMEquations
)
ae
).
collect
(
Collectors
.
toList
());
npoints
=
initialGuessList
.
size
();
}
/** Simple Constructor.
...
...
@@ -60,20 +66,20 @@ public class CR3BPMultipleShooter extends AbstractMultipleShooting {
* @param initialGuessList initial patch points to be corrected.
* @param propagatorList list of propagators associated to each patch point.
* @param arcDuration initial guess of the duration of each arc.
* @param
additionalDerivativesProvider
s list of additional derivatives providers linked to propagatorList.
* @param
stmEquation
s list of additional derivatives providers linked to propagatorList.
* @param tolerance convergence tolerance on the constraint vector
*/
public
CR3BPMultipleShooter
(
final
List
<
SpacecraftState
>
initialGuessList
,
final
List
<
NumericalPropagator
>
propagatorList
,
final
double
arcDuration
,
final
List
<
AdditionalDerivativesProvider
>
additionalDerivativesProvider
s
,
final
double
arcDuration
,
final
List
<
STMEquations
>
stmEquation
s
,
final
double
tolerance
)
{
super
(
initialGuessList
,
propagatorList
,
arcDuration
,
additionalDerivativesProviders
,
tolerance
,
STM
);
this
.
npoints
=
initialGuessList
.
size
();
super
(
initialGuessList
,
propagatorList
,
arcDuration
,
tolerance
,
STM
);
this
.
stmEquations
=
stmEquations
;
this
.
npoints
=
initialGuessList
.
size
();
}
/** {@inheritDoc} */
protected
SpacecraftState
getAugmentedInitialState
(
final
SpacecraftState
initialState
,
final
AdditionalDerivativesProvider
additionalDerivativesProvider
)
{
return
((
STMEquations
)
additionalDerivativesProvider
).
setInitialPhi
(
initialState
);
protected
SpacecraftState
getAugmentedInitialState
(
final
int
i
)
{
return
stmEquations
.
get
(
i
).
setInitialPhi
(
getPatchPoint
(
i
));
}
/** {@inheritDoc} */
...
...
src/main/java/org/orekit/utils/AbstractMultipleShooting.java
View file @
bcfe9b8a
...
...
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
import
org.hipparchus.linear.MatrixUtils
;
...
...
@@ -31,7 +30,6 @@ import org.orekit.attitudes.AttitudeProvider;
import
org.orekit.errors.OrekitException
;
import
org.orekit.errors.OrekitMessages
;
import
org.orekit.propagation.SpacecraftState
;
import
org.orekit.propagation.integration.AdditionalDerivativesProvider
;
import
org.orekit.propagation.numerical.NumericalPropagator
;
import
org.orekit.time.AbsoluteDate
;
...
...
@@ -47,9 +45,10 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
private
List
<
SpacecraftState
>
patchedSpacecraftStates
;
/** Derivatives linked to the Propagators.
* @
since 11.1
* @
deprecated as of 11.1 not used anymore
*/
private
final
List
<
AdditionalDerivativesProvider
>
additionalDerivativesProviders
;
@Deprecated
private
List
<
org
.
orekit
.
propagation
.
integration
.
AdditionalEquations
>
additionalEquations
;
/** List of Propagators. */
private
final
List
<
NumericalPropagator
>
propagatorList
;
...
...
@@ -92,39 +91,29 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
* @param arcDuration initial guess of the duration of each arc.
* @param tolerance convergence tolerance on the constraint vector.
* @param additionalName name of the additional equations
* @deprecated as of 11.1, replaced by {@link #AbstractMultipleShooting(List, List, double,
List,
double, String)}
* @deprecated as of 11.1, replaced by {@link #AbstractMultipleShooting(List, List, double, double, String)}
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
protected
AbstractMultipleShooting
(
final
List
<
SpacecraftState
>
initialGuessList
,
final
List
<
NumericalPropagator
>
propagatorList
,
final
List
<
org
.
orekit
.
propagation
.
integration
.
AdditionalEquations
>
additionalEquations
,
final
double
arcDuration
,
final
double
tolerance
,
final
String
additionalName
)
{
this
(
initialGuessList
,
propagatorList
,
arcDuration
,
additionalEquations
.
stream
().
map
(
ae
->
ae
instanceof
AdditionalDerivativesProvider
?
(
AdditionalDerivativesProvider
)
ae
:
new
org
.
orekit
.
propagation
.
integration
.
AdditionalEquationsAdapter
(
ae
,
()
->
propagatorList
.
get
(
0
).
getInitialState
())).
collect
(
Collectors
.
toList
()),
tolerance
,
additionalName
);
this
(
initialGuessList
,
propagatorList
,
arcDuration
,
tolerance
,
additionalName
);
this
.
additionalEquations
=
additionalEquations
;
}
/** Simple Constructor.
* <p> Standard constructor for multiple shooting </p>
* @param initialGuessList initial patch points to be corrected.
* @param propagatorList list of propagators associated to each patch point.
* @param additionalDerivativesProviders list of additional derivatives providers linked to propagatorList.
* @param arcDuration initial guess of the duration of each arc.
* @param tolerance convergence tolerance on the constraint vector.
* @param additionalName name of the additional equations
* @since 11.1
*/
protected
AbstractMultipleShooting
(
final
List
<
SpacecraftState
>
initialGuessList
,
final
List
<
NumericalPropagator
>
propagatorList
,
final
double
arcDuration
,
final
List
<
AdditionalDerivativesProvider
>
additionalDerivativesProviders
,
final
double
tolerance
,
final
String
additionalName
)
{
final
double
arcDuration
,
final
double
tolerance
,
final
String
additionalName
)
{
this
.
patchedSpacecraftStates
=
initialGuessList
;
this
.
propagatorList
=
propagatorList
;
this
.
additionalDerivativesProviders
=
additionalDerivativesProviders
;
this
.
additionalName
=
additionalName
;
// Should check if propagatorList.size() = initialGuessList.size() - 1
final
int
propagationNumber
=
initialGuessList
.
size
()
-
1
;
...
...
@@ -156,6 +145,15 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
this
.
mapConstraints
=
new
HashMap
<>();
}
/** Get a patch point.
* @param i index of the patch point
* @return state of the patch point
* @since 11.1
*/
protected
SpacecraftState
getPatchPoint
(
final
int
i
)
{
return
patchedSpacecraftStates
.
get
(
i
);
}
/** Set a component of a patch point to free or not.
* @param patchNumber Patch point with constraint
* @param componentIndex Component of the patch points which are constrained.
...
...
@@ -503,9 +501,7 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
// SpacecraftState initialization
final
SpacecraftState
initialState
=
patchedSpacecraftStates
.
get
(
i
);
final
SpacecraftState
augmentedInitialState
=
getAugmentedInitialState
(
initialState
,
additionalDerivativesProviders
.
get
(
i
));
final
SpacecraftState
augmentedInitialState
=
getAugmentedInitialState
(
i
);
// Propagator initialization
propagatorList
.
get
(
i
).
setInitialState
(
augmentedInitialState
);
...
...
@@ -513,7 +509,7 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
final
double
integrationTime
=
propagationTime
[
i
];
// Propagate trajectory
final
SpacecraftState
finalState
=
propagatorList
.
get
(
i
).
propagate
(
i
nitialState
.
getDate
().
shiftedBy
(
integrationTime
));
final
SpacecraftState
finalState
=
propagatorList
.
get
(
i
).
propagate
(
augmentedI
nitialState
.
getDate
().
shiftedBy
(
integrationTime
));
propagatedSP
.
add
(
finalState
);
}
...
...
@@ -627,11 +623,24 @@ public abstract class AbstractMultipleShooting implements MultipleShooting {
* @param initialState SpacecraftState without the additional state
* @param additionalEquations2 Additional Equations.
* @return augmentedSP SpacecraftState with the additional state within.
* @deprecated as of 11.1, replaced by {@link #getAugmentedInitialState(int)}
*/
protected
abstract
SpacecraftState
getAugmentedInitialState
(
SpacecraftState
initialState
,
AdditionalDerivativesProvider
additionalEquations2
);
@Deprecated
protected
SpacecraftState
getAugmentedInitialState
(
final
SpacecraftState
initialState
,
final
org
.
orekit
.
propagation
.
integration
.
AdditionalEquations
additionalEquations2
)
{
throw
new
UnsupportedOperationException
();
}
/** Compute the additional state from the additionalEquations.
* @param i index of the state
* @return augmentedSP SpacecraftState with the additional state within.
* @since 11.1
*/
protected
SpacecraftState
getAugmentedInitialState
(
final
int
i
)
{
// FIXME: this base implementation is only intended for version 11.1 to delegate to a deprecated method
// it should be removed in 12.0 when getAugmentedInitialState(SpacecraftState, AdditionalDerivativesProvider) is removed
return
getAugmentedInitialState
(
patchedSpacecraftStates
.
get
(
i
),
additionalEquations
.
get
(
i
));
}
/** Set the constraint of a closed orbit or not.
* @param isClosed true if orbit should be closed
...
...
src/main/java/org/orekit/utils/MultipleShooter.java
View file @
bcfe9b8a
...
...
@@ -18,9 +18,9 @@ package org.orekit.utils;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.orekit.propagation.SpacecraftState
;
import
org.orekit.propagation.integration.AdditionalDerivativesProvider
;
import
org.orekit.propagation.numerical.EpochDerivativesEquations
;
import
org.orekit.propagation.numerical.NumericalPropagator
;
...
...
@@ -36,6 +36,11 @@ public class MultipleShooter extends AbstractMultipleShooting {
/** Name fo the additional derivatives. */
private
static
final
String
DERIVATIVES
=
"derivatives"
;
/** Derivatives linked to the Propagators.
* @since 11.1
*/
private
final
List
<
EpochDerivativesEquations
>
epochEquations
;
/** Simple Constructor.
* <p> Standard constructor for multiple shooting which can be used with the CR3BP model.</p>
* @param initialGuessList initial patch points to be corrected.
...
...
@@ -50,26 +55,27 @@ public class MultipleShooter extends AbstractMultipleShooting {
final
List
<
org
.
orekit
.
propagation
.
integration
.
AdditionalEquations
>
additionalEquations
,
final
double
arcDuration
,
final
double
tolerance
)
{
super
(
initialGuessList
,
propagatorList
,
additionalEquations
,
arcDuration
,
tolerance
,
DERIVATIVES
);
epochEquations
=
additionalEquations
.
stream
().
map
(
ae
->
(
EpochDerivativesEquations
)
ae
).
collect
(
Collectors
.
toList
());
}
/** Simple Constructor.
* <p> Standard constructor for multiple shooting which can be used with the CR3BP model.</p>
* @param initialGuessList initial patch points to be corrected.
* @param arcDuration initial guess of the duration of each arc.
* @param
additionalDerivativesProvider
s list of additional derivatives providers linked to propagatorList.
* @param
epochEquation
s list of additional derivatives providers linked to propagatorList.
* @param propagatorList list of propagators associated to each patch point.
* @param tolerance convergence tolerance on the constraint vector
*/
public
MultipleShooter
(
final
List
<
SpacecraftState
>
initialGuessList
,
final
List
<
NumericalPropagator
>
propagatorList
,
final
double
arcDuration
,
final
List
<
AdditionalDerivativesProvider
>
additionalDerivativesProviders
,
final
double
tolerance
)
{
super
(
initialGuessList
,
propagatorList
,
arcDuration
,
additionalDerivativesProviders
,
tolerance
,
DERIVATIVES
);
final
List
<
EpochDerivativesEquations
>
epochEquations
,
final
double
tolerance
)
{
super
(
initialGuessList
,
propagatorList
,
arcDuration
,
tolerance
,
DERIVATIVES
);
this
.
epochEquations
=
epochEquations
;
}
/** {@inheritDoc} */
protected
SpacecraftState
getAugmentedInitialState
(
final
SpacecraftState
initialState
,
final
AdditionalDerivativesProvider
additionalDerivativesProvider
)
{
return
((
EpochDerivativesEquations
)
additionalDerivativesProvider
).
setInitialJacobians
(
initialState
);
protected
SpacecraftState
getAugmentedInitialState
(
final
int
i
)
{
return
epochEquations
.
get
(
i
).
setInitialJacobians
(
getPatchPoint
(
i
));
}
/** {@inheritDoc} */
...
...
src/test/java/org/orekit/propagation/numerical/CR3BPMultipleShooterTest.java
View file @
bcfe9b8a
...
...
@@ -36,7 +36,6 @@ import org.orekit.orbits.LibrationOrbitFamily;
import
org.orekit.orbits.LibrationOrbitType
;
import
org.orekit.orbits.RichardsonExpansion
;
import
org.orekit.propagation.SpacecraftState
;
import
org.orekit.propagation.integration.AdditionalDerivativesProvider
;
import
org.orekit.propagation.numerical.cr3bp.CR3BPForceModel
;
import
org.orekit.propagation.numerical.cr3bp.CR3BPMultipleShooter
;
import
org.orekit.propagation.numerical.cr3bp.STMEquations
;
...
...
@@ -73,7 +72,7 @@ public class CR3BPMultipleShooterTest {
vecAbsoluteTolerances
,
vecRelativeTolerances
);
final
int
narcs
=
1
;
final
List
<
AdditionalDerivativesProvider
>
cr3bpAdditionalEquations
=
new
ArrayList
<>(
narcs
)
;
final
List
<
STMEquations
>
cr3bpAdditionalEquations
=
new
ArrayList
<>(
narcs
)
;
cr3bpAdditionalEquations
.
add
(
new
STMEquations
(
syst
));
// Propagator definition for CR3BP
...
...
src/test/java/org/orekit/utils/MultipleShooterTest.java
View file @
bcfe9b8a
...
...
@@ -40,7 +40,6 @@ import org.orekit.forces.gravity.ThirdBodyAttractionEpoch;
import
org.orekit.frames.Frame
;
import
org.orekit.frames.FramesFactory
;
import
org.orekit.propagation.SpacecraftState
;
import
org.orekit.propagation.integration.AdditionalDerivativesProvider
;
import
org.orekit.propagation.numerical.EpochDerivativesEquations
;
import
org.orekit.propagation.numerical.NumericalPropagator
;
import
org.orekit.time.AbsoluteDate
;
...
...
@@ -128,7 +127,7 @@ public class MultipleShooterTest {
final
AbsolutePVCoordinates
firstGuessAPV
=
new
AbsolutePVCoordinates
(
primaryFrame
,
initialDate
,
firstGuess
);
List
<
SpacecraftState
>
firstGuessList2
=
generatePatchPointsEphemeris
(
sun
,
earth
,
firstGuessAPV
,
arcDuration
,
narcs
,
integrator
);
final
List
<
NumericalPropagator
>
propagatorList
=
initializePropagators
(
sun
,
earth
,
integrator
,
narcs
);
final
List
<
Additional
Derivatives
Provider
>
additionalDerivativesProvider
s
=
addDerivativesProviders
(
propagatorList
);
final
List
<
Epoch
Derivatives
Equations
>
epochEquation
s
=
addDerivativesProviders
(
propagatorList
);
for
(
int
i
=
0
;
i
<
narcs
+
1
;
i
++)
{
final
SpacecraftState
sp
=
firstGuessList2
.
get
(
i
);
...
...
@@ -157,7 +156,7 @@ public class MultipleShooterTest {
final
double
tolerance
=
1.0
;
MultipleShooter
multipleShooting
=
new
MultipleShooter
(
correctedList
,
propagatorList
,
arcDuration
,
additionalDerivativesProvider
s
,
tolerance
);
MultipleShooter
multipleShooting
=
new
MultipleShooter
(
correctedList
,
propagatorList
,
arcDuration
,
epochEquation
s
,
tolerance
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
0
,
false
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
1
,
false
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
2
,
false
);
...
...
@@ -231,7 +230,7 @@ public class MultipleShooterTest {
final
AbsolutePVCoordinates
firstGuessAPV
=
new
AbsolutePVCoordinates
(
primaryFrame
,
initialDate
,
firstGuess
);
List
<
SpacecraftState
>
firstGuessList2
=
generatePatchPointsEphemeris
(
sun
,
earth
,
firstGuessAPV
,
arcDuration
,
narcs
,
integrator
);
final
List
<
NumericalPropagator
>
propagatorList
=
initializePropagatorsWithEstimated
(
sun
,
earth
,
integrator
,
narcs
);
final
List
<
Additional
Derivatives
Provider
>
additionalDerivativesProvider
s
=
addDerivativesProviders
(
propagatorList
);
final
List
<
Epoch
Derivatives
Equations
>
epochEquation
s
=
addDerivativesProviders
(
propagatorList
);
for
(
int
i
=
0
;
i
<
narcs
+
1
;
i
++)
{
final
SpacecraftState
sp
=
firstGuessList2
.
get
(
i
);
...
...
@@ -260,7 +259,7 @@ public class MultipleShooterTest {
final
double
tolerance
=
1.0
;
MultipleShooter
multipleShooting
=
new
MultipleShooter
(
correctedList
,
propagatorList
,
arcDuration
,
additionalDerivativesProvider
s
,
tolerance
);
MultipleShooter
multipleShooting
=
new
MultipleShooter
(
correctedList
,
propagatorList
,
arcDuration
,
epochEquation
s
,
tolerance
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
0
,
false
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
1
,
false
);
multipleShooting
.
setPatchPointComponentFreedom
(
1
,
2
,
false
);
...
...
@@ -376,9 +375,9 @@ public class MultipleShooterTest {
return
propagatorList
;
}
private
static
List
<
Additional
Derivatives
Provider
>
addDerivativesProviders
(
List
<
NumericalPropagator
>
propagatorList
){
private
static
List
<
Epoch
Derivatives
Equations
>
addDerivativesProviders
(
List
<
NumericalPropagator
>
propagatorList
){
final
int
narcs
=
propagatorList
.
size
();
final
List
<
Additional
Derivatives
Provider
>
additionalEquations
=
new
ArrayList
<>(
narcs
)
;
final
List
<
Epoch
Derivatives
Equations
>
additionalEquations
=
new
ArrayList
<>(
narcs
)
;
for
(
int
i
=
0
;
i
<
narcs
;
i
++)
{
additionalEquations
.
add
(
new
EpochDerivativesEquations
(
"derivatives"
,
propagatorList
.
get
(
i
)));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment