1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.forces.inertia;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.hipparchus.CalculusFieldElement;
23 import org.hipparchus.geometry.euclidean.threed.FieldRotation;
24 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
25 import org.hipparchus.geometry.euclidean.threed.Rotation;
26 import org.hipparchus.geometry.euclidean.threed.Vector3D;
27 import org.orekit.errors.OrekitIllegalArgumentException;
28 import org.orekit.errors.OrekitMessages;
29 import org.orekit.forces.ForceModel;
30 import org.orekit.frames.FieldTransform;
31 import org.orekit.frames.Frame;
32 import org.orekit.frames.Transform;
33 import org.orekit.propagation.FieldSpacecraftState;
34 import org.orekit.propagation.SpacecraftState;
35 import org.orekit.utils.AbsolutePVCoordinates;
36 import org.orekit.utils.ParameterDriver;
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 public class InertialForces implements ForceModel {
65
66
67 private final Frame referenceInertialFrame;
68
69
70
71
72
73
74 public InertialForces(final Frame referenceInertialFrame)
75 throws OrekitIllegalArgumentException {
76 if (!referenceInertialFrame.isPseudoInertial()) {
77 throw new OrekitIllegalArgumentException(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME_NOT_SUITABLE_AS_REFERENCE_FOR_INERTIAL_FORCES,
78 referenceInertialFrame.getName());
79 }
80 this.referenceInertialFrame = referenceInertialFrame;
81 }
82
83
84 @Override
85 public boolean dependsOnPositionOnly() {
86 return false;
87 }
88
89
90 @Override
91 public Vector3D acceleration(final SpacecraftState s, final double[] parameters) {
92
93 final Transform inertToStateFrame = referenceInertialFrame.getTransformTo(s.getFrame(), s.getDate());
94 final Vector3D a1 = inertToStateFrame.getCartesian().getAcceleration();
95 final Rotation r1 = inertToStateFrame.getAngular().getRotation();
96 final Vector3D o1 = inertToStateFrame.getAngular().getRotationRate();
97 final Vector3D oDot1 = inertToStateFrame.getAngular().getRotationAcceleration();
98
99 final Vector3D p2 = s.getPosition();
100 final Vector3D v2 = s.getPVCoordinates().getVelocity();
101
102 final Vector3D crossCrossP = Vector3D.crossProduct(o1, Vector3D.crossProduct(o1, p2));
103 final Vector3D crossV = Vector3D.crossProduct(o1, v2);
104 final Vector3D crossDotP = Vector3D.crossProduct(oDot1, p2);
105
106
107
108 return r1.applyTo(a1).subtract(new Vector3D(2, crossV, 1, crossCrossP, 1, crossDotP));
109
110 }
111
112
113 @Override
114 public <T extends CalculusFieldElement<T>> FieldVector3D<T> acceleration(final FieldSpacecraftState<T> s,
115 final T[] parameters) {
116
117 final FieldTransform<T> inertToStateFrame = referenceInertialFrame.getTransformTo(s.getFrame(), s.getDate());
118 final FieldVector3D<T> a1 = inertToStateFrame.getCartesian().getAcceleration();
119 final FieldRotation<T> r1 = inertToStateFrame.getAngular().getRotation();
120 final FieldVector3D<T> o1 = inertToStateFrame.getAngular().getRotationRate();
121 final FieldVector3D<T> oDot1 = inertToStateFrame.getAngular().getRotationAcceleration();
122
123 final FieldVector3D<T> p2 = s.getPosition();
124 final FieldVector3D<T> v2 = s.getPVCoordinates().getVelocity();
125
126 final FieldVector3D<T> crossCrossP = FieldVector3D.crossProduct(o1, FieldVector3D.crossProduct(o1, p2));
127 final FieldVector3D<T> crossV = FieldVector3D.crossProduct(o1, v2);
128 final FieldVector3D<T> crossDotP = FieldVector3D.crossProduct(oDot1, p2);
129
130
131
132 return r1.applyTo(a1).subtract(new FieldVector3D<>(2, crossV, 1, crossCrossP, 1, crossDotP));
133
134 }
135
136
137 @Override
138 public List<ParameterDriver> getParametersDrivers() {
139 return Collections.emptyList();
140 }
141 }