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
Orekit
Orekit
Commits
f255c874
Commit
f255c874
authored
Jan 14, 2022
by
Luc Maisonobe
Browse files
Added orbit normalization feature.
parent
c558fd1a
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/changes/changes.xml
View file @
f255c874
...
...
@@ -21,6 +21,9 @@
</properties>
<body>
<release
version=
"11.1"
date=
"TBD"
description=
"TBD"
>
<action
dev=
"luc"
type=
"add"
>
Added an orbit normalization feature.
</action>
<action
dev=
"luc"
type=
"fix"
issue=
"849"
>
Added detector to FieldEventHandler.init arguments list.
</action>
...
...
src/main/java/org/orekit/orbits/OrbitType.java
View file @
f255c874
...
...
@@ -22,6 +22,7 @@ import org.hipparchus.CalculusFieldElement;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
import
org.hipparchus.util.FastMath
;
import
org.hipparchus.util.MathUtils
;
import
org.orekit.errors.OrekitException
;
import
org.orekit.errors.OrekitMessages
;
import
org.orekit.frames.Frame
;
...
...
@@ -166,6 +167,20 @@ public enum OrbitType {
return
drivers
;
}
/** {@inheritDoc} */
@Override
public
CartesianOrbit
normalize
(
final
Orbit
orbit
,
final
Orbit
reference
)
{
// no angular parameters need normalization
return
convertType
(
orbit
);
}
/** {@inheritDoc} */
@Override
public
<
T
extends
CalculusFieldElement
<
T
>>
FieldCartesianOrbit
<
T
>
normalize
(
final
FieldOrbit
<
T
>
orbit
,
final
FieldOrbit
<
T
>
reference
)
{
// no angular parameters need normalization
return
convertType
(
orbit
);
}
},
/** Type for propagation in {@link CircularOrbit circular parameters}. */
...
...
@@ -302,6 +317,88 @@ public enum OrbitType {
return
drivers
;
}
/** {@inheritDoc} */
@Override
public
CircularOrbit
normalize
(
final
Orbit
orbit
,
final
Orbit
reference
)
{
// convert input to proper type
final
CircularOrbit
cO
=
convertType
(
orbit
);
final
CircularOrbit
cR
=
convertType
(
reference
);
// perform normalization
if
(
cO
.
hasDerivatives
())
{
return
new
CircularOrbit
(
cO
.
getA
(),
cO
.
getCircularEx
(),
cO
.
getCircularEy
(),
cO
.
getI
(),
MathUtils
.
normalizeAngle
(
cO
.
getRightAscensionOfAscendingNode
(),
cR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
cO
.
getAlphaV
(),
cR
.
getAlphaV
()),
cO
.
getADot
(),
cO
.
getCircularExDot
(),
cO
.
getCircularEyDot
(),
cO
.
getIDot
(),
cO
.
getRightAscensionOfAscendingNodeDot
(),
cO
.
getAlphaVDot
(),
PositionAngle
.
TRUE
,
cO
.
getFrame
(),
cO
.
getDate
(),
cO
.
getMu
());
}
else
{
return
new
CircularOrbit
(
cO
.
getA
(),
cO
.
getCircularEx
(),
cO
.
getCircularEy
(),
cO
.
getI
(),
MathUtils
.
normalizeAngle
(
cO
.
getRightAscensionOfAscendingNode
(),
cR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
cO
.
getAlphaV
(),
cR
.
getAlphaV
()),
PositionAngle
.
TRUE
,
cO
.
getFrame
(),
cO
.
getDate
(),
cO
.
getMu
());
}
}
/** {@inheritDoc} */
@Override
public
<
T
extends
CalculusFieldElement
<
T
>>
FieldCircularOrbit
<
T
>
normalize
(
final
FieldOrbit
<
T
>
orbit
,
final
FieldOrbit
<
T
>
reference
)
{
// convert input to proper type
final
FieldCircularOrbit
<
T
>
cO
=
convertType
(
orbit
);
final
FieldCircularOrbit
<
T
>
cR
=
convertType
(
reference
);
// perform normalization
if
(
cO
.
hasDerivatives
())
{
return
new
FieldCircularOrbit
<>(
cO
.
getA
(),
cO
.
getCircularEx
(),
cO
.
getCircularEy
(),
cO
.
getI
(),
MathUtils
.
normalizeAngle
(
cO
.
getRightAscensionOfAscendingNode
(),
cR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
cO
.
getAlphaV
(),
cR
.
getAlphaV
()),
cO
.
getADot
(),
cO
.
getCircularExDot
(),
cO
.
getCircularEyDot
(),
cO
.
getIDot
(),
cO
.
getRightAscensionOfAscendingNodeDot
(),
cO
.
getAlphaVDot
(),
PositionAngle
.
TRUE
,
cO
.
getFrame
(),
cO
.
getDate
(),
cO
.
getMu
());
}
else
{
return
new
FieldCircularOrbit
<>(
cO
.
getA
(),
cO
.
getCircularEx
(),
cO
.
getCircularEy
(),
cO
.
getI
(),
MathUtils
.
normalizeAngle
(
cO
.
getRightAscensionOfAscendingNode
(),
cR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
cO
.
getAlphaV
(),
cR
.
getAlphaV
()),
PositionAngle
.
TRUE
,
cO
.
getFrame
(),
cO
.
getDate
(),
cO
.
getMu
());
}
}
},
/** Type for propagation in {@link EquinoctialOrbit equinoctial parameters}. */
...
...
@@ -441,6 +538,87 @@ public enum OrbitType {
return
drivers
;
}
/** {@inheritDoc} */
@Override
public
EquinoctialOrbit
normalize
(
final
Orbit
orbit
,
final
Orbit
reference
)
{
// convert input to proper type
final
EquinoctialOrbit
eO
=
convertType
(
orbit
);
final
EquinoctialOrbit
eR
=
convertType
(
reference
);
// perform normalization
if
(
eO
.
hasDerivatives
())
{
return
new
EquinoctialOrbit
(
eO
.
getA
(),
eO
.
getEquinoctialEx
(),
eO
.
getEquinoctialEy
(),
eO
.
getHx
(),
eO
.
getHy
(),
MathUtils
.
normalizeAngle
(
eO
.
getLv
(),
eR
.
getLv
()),
eO
.
getADot
(),
eO
.
getEquinoctialExDot
(),
eO
.
getEquinoctialEyDot
(),
eO
.
getHxDot
(),
eO
.
getHyDot
(),
eO
.
getLvDot
(),
PositionAngle
.
TRUE
,
eO
.
getFrame
(),
eO
.
getDate
(),
eO
.
getMu
());
}
else
{
return
new
EquinoctialOrbit
(
eO
.
getA
(),
eO
.
getEquinoctialEx
(),
eO
.
getEquinoctialEy
(),
eO
.
getHx
(),
eO
.
getHy
(),
MathUtils
.
normalizeAngle
(
eO
.
getLv
(),
eR
.
getLv
()),
PositionAngle
.
TRUE
,
eO
.
getFrame
(),
eO
.
getDate
(),
eO
.
getMu
());
}
}
/** {@inheritDoc} */
@Override
public
<
T
extends
CalculusFieldElement
<
T
>>
FieldEquinoctialOrbit
<
T
>
normalize
(
final
FieldOrbit
<
T
>
orbit
,
final
FieldOrbit
<
T
>
reference
)
{
// convert input to proper type
final
FieldEquinoctialOrbit
<
T
>
eO
=
convertType
(
orbit
);
final
FieldEquinoctialOrbit
<
T
>
eR
=
convertType
(
reference
);
// perform normalization
if
(
eO
.
hasDerivatives
())
{
return
new
FieldEquinoctialOrbit
<>(
eO
.
getA
(),
eO
.
getEquinoctialEx
(),
eO
.
getEquinoctialEy
(),
eO
.
getHx
(),
eO
.
getHy
(),
MathUtils
.
normalizeAngle
(
eO
.
getLv
(),
eR
.
getLv
()),
eO
.
getADot
(),
eO
.
getEquinoctialExDot
(),
eO
.
getEquinoctialEyDot
(),
eO
.
getHxDot
(),
eO
.
getHyDot
(),
eO
.
getLvDot
(),
PositionAngle
.
TRUE
,
eO
.
getFrame
(),
eO
.
getDate
(),
eO
.
getMu
());
}
else
{
return
new
FieldEquinoctialOrbit
<>(
eO
.
getA
(),
eO
.
getEquinoctialEx
(),
eO
.
getEquinoctialEy
(),
eO
.
getHx
(),
eO
.
getHy
(),
MathUtils
.
normalizeAngle
(
eO
.
getLv
(),
eR
.
getLv
()),
PositionAngle
.
TRUE
,
eO
.
getFrame
(),
eO
.
getDate
(),
eO
.
getMu
());
}
}
},
...
...
@@ -580,6 +758,88 @@ public enum OrbitType {
return
drivers
;
}
/** {@inheritDoc} */
@Override
public
KeplerianOrbit
normalize
(
final
Orbit
orbit
,
final
Orbit
reference
)
{
// convert input to proper type
final
KeplerianOrbit
kO
=
convertType
(
orbit
);
final
KeplerianOrbit
kR
=
convertType
(
reference
);
// perform normalization
if
(
kO
.
hasDerivatives
())
{
return
new
KeplerianOrbit
(
kO
.
getA
(),
kO
.
getE
(),
kO
.
getI
(),
MathUtils
.
normalizeAngle
(
kO
.
getPerigeeArgument
(),
kR
.
getPerigeeArgument
()),
MathUtils
.
normalizeAngle
(
kO
.
getRightAscensionOfAscendingNode
(),
kR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
kO
.
getTrueAnomaly
(),
kR
.
getTrueAnomaly
()),
kO
.
getADot
(),
kO
.
getEDot
(),
kO
.
getIDot
(),
kO
.
getPerigeeArgumentDot
(),
kO
.
getRightAscensionOfAscendingNodeDot
(),
kO
.
getTrueAnomalyDot
(),
PositionAngle
.
TRUE
,
kO
.
getFrame
(),
kO
.
getDate
(),
kO
.
getMu
());
}
else
{
return
new
KeplerianOrbit
(
kO
.
getA
(),
kO
.
getE
(),
kO
.
getI
(),
MathUtils
.
normalizeAngle
(
kO
.
getPerigeeArgument
(),
kR
.
getPerigeeArgument
()),
MathUtils
.
normalizeAngle
(
kO
.
getRightAscensionOfAscendingNode
(),
kR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
kO
.
getTrueAnomaly
(),
kR
.
getTrueAnomaly
()),
PositionAngle
.
TRUE
,
kO
.
getFrame
(),
kO
.
getDate
(),
kO
.
getMu
());
}
}
/** {@inheritDoc} */
@Override
public
<
T
extends
CalculusFieldElement
<
T
>>
FieldKeplerianOrbit
<
T
>
normalize
(
final
FieldOrbit
<
T
>
orbit
,
final
FieldOrbit
<
T
>
reference
)
{
// convert input to proper type
final
FieldKeplerianOrbit
<
T
>
kO
=
convertType
(
orbit
);
final
FieldKeplerianOrbit
<
T
>
kR
=
convertType
(
reference
);
// perform normalization
if
(
kO
.
hasDerivatives
())
{
return
new
FieldKeplerianOrbit
<>(
kO
.
getA
(),
kO
.
getE
(),
kO
.
getI
(),
MathUtils
.
normalizeAngle
(
kO
.
getPerigeeArgument
(),
kR
.
getPerigeeArgument
()),
MathUtils
.
normalizeAngle
(
kO
.
getRightAscensionOfAscendingNode
(),
kR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
kO
.
getTrueAnomaly
(),
kR
.
getTrueAnomaly
()),
kO
.
getADot
(),
kO
.
getEDot
(),
kO
.
getIDot
(),
kO
.
getPerigeeArgumentDot
(),
kO
.
getRightAscensionOfAscendingNodeDot
(),
kO
.
getTrueAnomalyDot
(),
PositionAngle
.
TRUE
,
kO
.
getFrame
(),
kO
.
getDate
(),
kO
.
getMu
());
}
else
{
return
new
FieldKeplerianOrbit
<>(
kO
.
getA
(),
kO
.
getE
(),
kO
.
getI
(),
MathUtils
.
normalizeAngle
(
kO
.
getPerigeeArgument
(),
kR
.
getPerigeeArgument
()),
MathUtils
.
normalizeAngle
(
kO
.
getRightAscensionOfAscendingNode
(),
kR
.
getRightAscensionOfAscendingNode
()),
MathUtils
.
normalizeAngle
(
kO
.
getTrueAnomaly
(),
kR
.
getTrueAnomaly
()),
PositionAngle
.
TRUE
,
kO
.
getFrame
(),
kO
.
getDate
(),
kO
.
getMu
());
}
}
};
/** Name for position along X. */
...
...
@@ -750,10 +1010,10 @@ public enum OrbitType {
* @return orbit corresponding to the flat array as a space dynamics object
*/
public
abstract
<
T
extends
CalculusFieldElement
<
T
>>
FieldOrbit
<
T
>
mapArrayToOrbit
(
T
[]
array
,
T
[]
arrayDot
,
PositionAngle
type
,
FieldAbsoluteDate
<
T
>
date
,
T
mu
,
Frame
frame
);
T
[]
arrayDot
,
PositionAngle
type
,
FieldAbsoluteDate
<
T
>
date
,
T
mu
,
Frame
frame
);
/** Get parameters drivers initialized from a reference orbit.
* @param dP user specified position error
...
...
@@ -764,6 +1024,41 @@ public enum OrbitType {
public
abstract
ParameterDriversList
getDrivers
(
double
dP
,
Orbit
orbit
,
PositionAngle
type
);
/** Normalize one orbit with respect to a reference one.
* <p>
* Given a, angular component ζ of an orbit and the corresponding
* angular component ζᵣ in the reference orbit, the angular component
* ζₙ of the normalized orbit will be ζₙ = ζ + 2kπ
* where k is chosen such that ζᵣ - π ≤ ζₙ ≤ ζᵣ + π. This is intended
* to avoid too large discontinuities and is particularly useful
* for normalizing the orbit after an impulsive maneuver with respect
* to the reference picked up before the maneuver.
* </p>
* @param <T> CalculusFieldElement used
* @param orbit orbit to normalize
* @param reference reference orbit
* @return normalized orbit (the type is guaranteed to match {@link OrbitType})
* @since 11.1
*/
public
abstract
<
T
extends
CalculusFieldElement
<
T
>>
FieldOrbit
<
T
>
normalize
(
FieldOrbit
<
T
>
orbit
,
FieldOrbit
<
T
>
reference
);
/** Normalize one orbit with respect to a reference one.
* <p>
* Given a, angular component ζ of an orbit and the corresponding
* angular component ζᵣ in the reference orbit, the angular component
* ζₙ of the normalized orbit will be ζₙ = ζ + 2kπ
* where k is chosen such that ζᵣ - π ≤ ζₙ ≤ ζᵣ + π. This is intended
* to avoid too large discontinuities and is particularly useful
* for normalizing the orbit after an impulsive maneuver with respect
* to the reference picked up before the maneuver.
* </p>
* @param orbit orbit to normalize
* @param reference reference orbit
* @return normalized orbit (the type is guaranteed to match {@link OrbitType})
* @since 11.1
*/
public
abstract
Orbit
normalize
(
Orbit
orbit
,
Orbit
reference
);
/** Compute scaling factor for parameters drivers.
* <p>
* The scales are estimated from partial derivatives properties of orbits,
...
...
src/test/java/org/orekit/orbits/CartesianOrbitTest.java
View file @
f255c874
...
...
@@ -741,6 +741,15 @@ public class CartesianOrbitTest {
}
@Test
public
void
testNormalize
()
{
final
Vector3D
position
=
new
Vector3D
(
42164140
,
0
,
0
);
final
PVCoordinates
pv
=
new
PVCoordinates
(
position
,
new
Vector3D
(
0
,
FastMath
.
sqrt
(
mu
/
position
.
getNorm
()),
0
));
final
Orbit
orbit
=
new
CartesianOrbit
(
pv
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Assert
.
assertSame
(
orbit
,
orbit
.
getType
().
normalize
(
orbit
,
null
));
}
@Before
public
void
setUp
()
{
...
...
src/test/java/org/orekit/orbits/CircularOrbitTest.java
View file @
f255c874
...
...
@@ -73,7 +73,7 @@ public class CircularOrbitTest {
// elliptic orbit
CircularOrbit
circ
=
new
CircularOrbit
(
42166
.
712
,
0.5
,
-
0.5
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
0.5
,
-
0.5
,
i
,
raan
,
5.300
-
raan
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
pos
=
circ
.
getPVCoordinates
().
getPosition
();
...
...
@@ -101,7 +101,7 @@ public class CircularOrbitTest {
// circular orbit
EquinoctialOrbit
circCir
=
new
EquinoctialOrbit
(
42166
.
712
,
0.1
e
-
10
,
-
0.1
e
-
10
,
i
,
raan
,
new
EquinoctialOrbit
(
42166712
.0
,
0.1
e
-
10
,
-
0.1
e
-
10
,
i
,
raan
,
5.300
-
raan
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
posCir
=
circCir
.
getPVCoordinates
().
getPosition
();
...
...
@@ -134,7 +134,7 @@ public class CircularOrbitTest {
double
ey
=
eyTilde
*
cosRaan
-
exTilde
*
sinRaan
;
CircularOrbit
circ
=
new
CircularOrbit
(
42166
.
712
,
ex
,
ey
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
ex
,
ey
,
i
,
raan
,
5.300
-
raan
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
pos
=
circ
.
getPVCoordinates
().
getPosition
();
...
...
@@ -145,13 +145,13 @@ public class CircularOrbitTest {
double
v
=
vel
.
getNorm
();
Assert
.
assertEquals
(
2
/
r
-
v
*
v
/
mu
,
1
/
circ
.
getA
(),
1.0
e
-
7
);
Assert
.
assertEquals
(
0.233745668678733
e
+
0
5
,
pos
.
getX
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(-
0.350998914352669
e
+
0
5
,
pos
.
getY
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(-
0.150053723123334
e
+
0
1
,
pos
.
getZ
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(
0.233745668678733
e
+
0
8
,
pos
.
getX
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(-
0.350998914352669
e
+
0
8
,
pos
.
getY
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(-
0.150053723123334
e
+
0
4
,
pos
.
getZ
(),
Utils
.
epsilonTest
*
r
);
Assert
.
assertEquals
(
0.809135038364960
e
+
05
,
vel
.
getX
(),
Utils
.
epsilonTest
*
v
);
Assert
.
assertEquals
(
0.538902268252598
e
+
05
,
vel
.
getY
(),
Utils
.
epsilonTest
*
v
);
Assert
.
assertEquals
(
0.158527938296630
e
+
02
,
vel
.
getZ
(),
Utils
.
epsilonTest
*
v
);
Assert
.
assertEquals
(
2558.7096558809967
,
vel
.
getX
(),
Utils
.
epsilonTest
*
v
);
Assert
.
assertEquals
(
1704.1586039092576
,
vel
.
getY
(),
Utils
.
epsilonTest
*
v
);
Assert
.
assertEquals
(
0.5013093577879
,
vel
.
getZ
(),
Utils
.
epsilonTest
*
v
);
}
...
...
@@ -170,12 +170,12 @@ public class CircularOrbitTest {
double
ey
=
eyTilde
*
cosRaan
-
exTilde
*
sinRaan
;
CircularOrbit
circ
=
new
CircularOrbit
(
42166
.
712
,
ex
,
ey
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
ex
,
ey
,
i
,
raan
,
5.300
-
raan
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
KeplerianOrbit
kep
=
new
KeplerianOrbit
(
circ
);
Assert
.
assertEquals
(
42166
.
71200
,
circ
.
getA
(),
Utils
.
epsilonTest
*
kep
.
getA
());
Assert
.
assertEquals
(
42166712
.0
00
,
circ
.
getA
(),
Utils
.
epsilonTest
*
kep
.
getA
());
Assert
.
assertEquals
(
0.110283316961361
e
-
03
,
kep
.
getE
(),
Utils
.
epsilonE
*
FastMath
.
abs
(
kep
.
getE
()));
Assert
.
assertEquals
(
0.166901168553917
e
-
03
,
kep
.
getI
(),
Utils
.
epsilonAngle
*
FastMath
.
abs
(
kep
.
getI
()));
...
...
@@ -194,7 +194,7 @@ public class CircularOrbitTest {
@Test
public
void
testHyperbolic1
()
{
try
{
new
CircularOrbit
(
42166
.
712
,
0.9
,
0.5
,
0.01
,
-
0.02
,
5.300
,
new
CircularOrbit
(
42166712
.0
,
0.9
,
0.5
,
0.01
,
-
0.02
,
5.300
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
}
catch
(
OrekitIllegalArgumentException
oe
)
{
Assert
.
assertEquals
(
OrekitMessages
.
HYPERBOLIC_ORBIT_NOT_HANDLED_AS
,
oe
.
getSpecifier
());
...
...
@@ -203,7 +203,7 @@ public class CircularOrbitTest {
@Test
public
void
testHyperbolic2
()
{
Orbit
orbit
=
new
KeplerianOrbit
(
42166
.
712
,
0.9
,
0.5
,
0.01
,
-
0.02
,
5.300
,
Orbit
orbit
=
new
KeplerianOrbit
(
42166712
.0
,
0.9
,
0.5
,
0.01
,
-
0.02
,
5.300
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
try
{
new
CircularOrbit
(
orbit
.
getPVCoordinates
(),
orbit
.
getFrame
(),
orbit
.
getMu
());
...
...
@@ -320,7 +320,7 @@ public class CircularOrbitTest {
double
i
=
2
*
FastMath
.
atan
(
FastMath
.
sqrt
(
hx
*
hx
+
hy
*
hy
));
double
raan
=
FastMath
.
atan2
(
hy
,
hx
);
CircularOrbit
p
=
new
CircularOrbit
(
42166
.
712
,
0.5
,
-
0.5
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
0.5
,
-
0.5
,
i
,
raan
,
0.67
-
raan
,
PositionAngle
.
TRUE
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
...
...
@@ -377,7 +377,7 @@ public class CircularOrbitTest {
double
i
=
2
*
FastMath
.
atan
(
FastMath
.
sqrt
(
hx
*
hx
+
hy
*
hy
));
double
raan
=
FastMath
.
atan2
(
hy
,
hx
);
CircularOrbit
pCirEqua
=
new
CircularOrbit
(
42166
.
712
,
0.1
e
-
8
,
0.1
e
-
8
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
0.1
e
-
8
,
0.1
e
-
8
,
i
,
raan
,
0.67
-
raan
,
PositionAngle
.
TRUE
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
...
...
@@ -408,7 +408,7 @@ public class CircularOrbitTest {
double
i
=
2
*
FastMath
.
atan
(
FastMath
.
sqrt
(
hx
*
hx
+
hy
*
hy
));
double
raan
=
FastMath
.
atan2
(
hy
,
hx
);
CircularOrbit
p
=
new
CircularOrbit
(
42166
.
712
,
0.5
,
-
0.5
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
0.5
,
-
0.5
,
i
,
raan
,
0.67
-
raan
,
PositionAngle
.
TRUE
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
...
...
@@ -452,7 +452,7 @@ public class CircularOrbitTest {
double
i
=
2
*
FastMath
.
atan
(
FastMath
.
sqrt
(
hx
*
hx
+
hy
*
hy
));
double
raan
=
FastMath
.
atan2
(
hy
,
hx
);
CircularOrbit
pCirEqua
=
new
CircularOrbit
(
42166
.
712
,
0.1
e
-
8
,
0.1
e
-
8
,
i
,
raan
,
new
CircularOrbit
(
42166712
.0
,
0.1
e
-
8
,
0.1
e
-
8
,
i
,
raan
,
0.67
-
raan
,
PositionAngle
.
TRUE
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
...
...
@@ -1199,6 +1199,57 @@ public class CircularOrbitTest {
}
@Test
public
void
testNormalize
()
{
CircularOrbit
withoutDerivatives
=
new
CircularOrbit
(
42166712.0
,
0.005
,
-
0.025
,
1.6
,
1.25
,
0.4
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
CircularOrbit
ref
=
new
CircularOrbit
(
24000000.0
,
-
0.012
,
0.01
,
0.2
,
-
6.28
,
6.28
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
CircularOrbit
normalized1
=
(
CircularOrbit
)
OrbitType
.
CIRCULAR
.
normalize
(
withoutDerivatives
,
ref
);
Assert
.
assertFalse
(
normalized1
.
hasDerivatives
());
Assert
.
assertEquals
(
0.0
,
normalized1
.
getA
()
-
withoutDerivatives
.
getA
(),
1.0
e
-
6
);
Assert
.
assertEquals
(
0.0
,
normalized1
.
getCircularEx
()
-
withoutDerivatives
.
getCircularEx
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized1
.
getCircularEy
()
-
withoutDerivatives
.
getCircularEy
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized1
.
getI
()
-
withoutDerivatives
.
getI
(),
1.0
e
-
10
);
Assert
.
assertEquals
(-
MathUtils
.
TWO_PI
,
normalized1
.
getRightAscensionOfAscendingNode
()
-
withoutDerivatives
.
getRightAscensionOfAscendingNode
(),
1.0
e
-
10
);
Assert
.
assertEquals
(+
MathUtils
.
TWO_PI
,
normalized1
.
getAlphaV
()
-
withoutDerivatives
.
getAlphaV
(),
1.0
e
-
10
);
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getADot
()));
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getCircularExDot
()));
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getCircularEyDot
()));
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getIDot
()));
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getRightAscensionOfAscendingNodeDot
()));
Assert
.
assertTrue
(
Double
.
isNaN
(
normalized1
.
getAlphaVDot
()));
double
[]
p
=
new
double
[
6
];
OrbitType
.
CIRCULAR
.
mapOrbitToArray
(
withoutDerivatives
,
PositionAngle
.
TRUE
,
p
,
null
);
CircularOrbit
withDerivatives
=
(
CircularOrbit
)
OrbitType
.
CIRCULAR
.
mapArrayToOrbit
(
p
,
new
double
[]
{
1.0
,
2.0
,
3.0
,
4.0
,
5.0
,
6.0
},
PositionAngle
.
TRUE
,
withoutDerivatives
.
getDate
(),
withoutDerivatives
.
getMu
(),
withoutDerivatives
.
getFrame
());
CircularOrbit
normalized2
=
(
CircularOrbit
)
OrbitType
.
CIRCULAR
.
normalize
(
withDerivatives
,
ref
);
Assert
.
assertTrue
(
normalized2
.
hasDerivatives
());
Assert
.
assertEquals
(
0.0
,
normalized2
.
getA
()
-
withDerivatives
.
getA
(),
1.0
e
-
6
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getCircularEx
()
-
withDerivatives
.
getCircularEx
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getCircularEy
()
-
withDerivatives
.
getCircularEy
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getI
()
-
withDerivatives
.
getI
(),
1.0
e
-
10
);
Assert
.
assertEquals
(-
MathUtils
.
TWO_PI
,
normalized2
.
getRightAscensionOfAscendingNode
()
-
withDerivatives
.
getRightAscensionOfAscendingNode
(),
1.0
e
-
10
);
Assert
.
assertEquals
(+
MathUtils
.
TWO_PI
,
normalized2
.
getAlphaV
()
-
withDerivatives
.
getAlphaV
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getADot
()
-
withDerivatives
.
getADot
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getCircularExDot
()
-
withDerivatives
.
getCircularExDot
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getCircularEyDot
()
-
withDerivatives
.
getCircularEyDot
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getIDot
()
-
withDerivatives
.
getIDot
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getRightAscensionOfAscendingNodeDot
()
-
withDerivatives
.
getRightAscensionOfAscendingNodeDot
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.0
,
normalized2
.
getAlphaVDot
()
-
withDerivatives
.
getAlphaVDot
(),
1.0
e
-
10
);
}
@Before
public
void
setUp
()
{
...
...
src/test/java/org/orekit/orbits/EquinoctialOrbitTest.java
View file @
f255c874
...
...
@@ -72,7 +72,7 @@ public class EquinoctialOrbitTest {
// elliptic orbit
EquinoctialOrbit
equi
=
new
EquinoctialOrbit
(
42166
.
712
,
0.5
,
-
0.5
,
hx
,
hy
,
new
EquinoctialOrbit
(
42166712
.0
,
0.5
,
-
0.5
,
hx
,
hy
,
5.300
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
pos
=
equi
.
getPVCoordinates
().
getPosition
();
...
...
@@ -106,7 +106,7 @@ public class EquinoctialOrbitTest {
// circular orbit
EquinoctialOrbit
equiCir
=
new
EquinoctialOrbit
(
42166
.
712
,
0.1
e
-
10
,
-
0.1
e
-
10
,
hx
,
hy
,
new
EquinoctialOrbit
(
42166712
.0
,
0.1
e
-
10
,
-
0.1
e
-
10
,
hx
,
hy
,
5.300
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
posCir
=
equiCir
.
getPVCoordinates
().
getPosition
();
...
...
@@ -141,7 +141,7 @@ public class EquinoctialOrbitTest {
double
hy
=
FastMath
.
tan
(
inc
/
2
.)
*
iy
/
(
2
*
FastMath
.
sin
(
inc
/
2
.));
EquinoctialOrbit
equi
=
new
EquinoctialOrbit
(
42166
.
712
,
-
7.900
e
-
06
,
1.100
e
-
04
,
hx
,
hy
,
new
EquinoctialOrbit
(
42166712
.0
,
-
7.900
e
-
06
,
1.100
e
-
04
,
hx
,
hy
,
5.300
,
PositionAngle
.
MEAN
,
FramesFactory
.
getEME2000
(),
date
,
mu
);
Vector3D
pos
=
equi
.
getPVCoordinates
().
getPosition
();
...
...
@@ -151,19 +151,13 @@ public class EquinoctialOrbitTest {
double
oneovera
=
(
2
.
/
pos
.
getNorm
())
-
vit
.
getNorm
()
*
vit
.
getNorm
()
/
mu
;