Lunar Free Return Code Sample |
The two primary classes of Lunar free return trajectories are categorized in terms of whether their Lunar flyby occurs between the Earth and the Moon (cislunar) or past the Moon (circumlunar). Their design is so similar that most of the code in this example is shared between the two classes. The main practical difference between the two classes is that the cislunar free return has a much longer time of flight: about 13 days from the Earth to the Moon and about 13 days to return to the Earth. The circumlunar free return takes about 3 days to get to the Moon and 3 days to return to the Earth.
Free return trajectories are symmetric in the circular, restricted three-body problem, but the the Solar gravitational perturbations and spherical harmonic gravity models used in this example break that symmetry. However, this symmetry can still be used to inform a mission design strategy.
A rotating frame can be defined using the Earth-Moon line and the normal vector of the Moon's orbit about the Earth. Initial guesses for the flybys can be defined easily in terms of this rotating frame. These initial guesses can be used to backward target initial guesses for Earth parking orbit and translunar injection maneuver conditions. The Earth conditions can be varied in order to forward target the desired Earth re-entry conditions with an implicit Lunar flyby. In this example, the Lunar flyby altitudes are higher than the initial guess which is not necessarily going to be true in the general case. The flyby initial guesses may need to have their altitudes increased to ensure safe lunar flyby conditions occur.
Note |
---|
The functionality described in this topic requires a license for the Segment Propagation Library. |
The initial setup code includes common setup that is needed for both circumlunar and cislunar free return targeting.
// Pick names. final String motionID = "Satellite"; final String dryMassID = "Dry_Mass"; // Use JPL DE 440 ephemerides for positions of Sun, Moon, and Earth. JplDE440 ephem = new JplDE440(pathToJplDe440); ephem.useForCentralBodyPositions(CentralBodiesFacet.getFromContext()); // Store commonly used central bodies and constants. CentralBody moon = CentralBodiesFacet.getFromContext().getMoon(); SphericalHarmonicGravityModel moonGravityModel = SphericalHarmonicGravityModel.readFrom(pathToMoonGravFile); double moonGravitationalParameter = moonGravityModel.getGravitationalParameter(); // m^3/s^2. double moonPhysicalRadius = moonGravityModel.getReferenceDistance(); // Meters. CentralBody sun = CentralBodiesFacet.getFromContext().getSun(); final double sunGravitationalParameter = 1.3271244004193938e20; // m^3/s^2. CentralBody earth = CentralBodiesFacet.getFromContext().getEarth(); SphericalHarmonicGravityModel earthGravityModel = SphericalHarmonicGravityModel.readFrom(pathToEarthGravFile); final double earthGravitationalParameter = earthGravityModel.getGravitationalParameter(); double earthPhysicalRadius = earthGravityModel.getReferenceDistance(); // Meters. // Set up rotating reference frames. VectorTrueDisplacement earthMoonVector = new VectorTrueDisplacement(earth.getCenterOfMassPoint(), moon.getCenterOfMassPoint()); VectorVelocity moonOrbitalVelocity = new VectorVelocity(moon.getCenterOfMassPoint(), getEarth().getInertialFrame()); VectorCrossProduct moonOrbitalAngularMomentum = new VectorCrossProduct(earthMoonVector, moonOrbitalVelocity); AxesAlignedConstrained rotatingAxes = new AxesAlignedConstrained(earthMoonVector, AxisIndicator.FIRST, moonOrbitalAngularMomentum, AxisIndicator.THIRD); ReferenceFrame moonCenteredRotatingFrame = new ReferenceFrame(moon.getCenterOfMassPoint(), rotatingAxes); double earthMoonMassRatio = earthGravitationalParameter / moonGravitationalParameter; double scaleFactor = 1.0 / (1.0 + earthMoonMassRatio); VectorScaled earthToBarycenterVector = new VectorScaled(earthMoonVector, Scalar.toScalar(scaleFactor)); Point barycenter = new PointVectorToPoint(earthToBarycenterVector, earth.getCenterOfMassPoint()); ReferenceFrame barycentricRotatingFrame = new ReferenceFrame(barycenter, rotatingAxes); // Get reference frame transformation from Moon rotating frame to Moon inertial frame. EvaluatorGroup group = new EvaluatorGroup(); ReferenceFrameEvaluator fromMoonRotatingToMoonInertial = GeometryTransformer.getReferenceFrameTransformation(moonCenteredRotatingFrame, moon.getInertialFrame(), group); // Initial guess date for Lunar flyby. JulianDate epoch = new JulianDate(new GregorianDate(2023, 1, 1), TimeStandard.getCoordinatedUniversalTime()); // Get transformations at epoch. Order 1 allows velocity information to be transformed. final KinematicTransformation fromMoonRotatingAtEpoch = fromMoonRotatingToMoonInertial.evaluate(epoch, 1); final KinematicTransformation toMoonRotatingAtEpoch = fromMoonRotatingAtEpoch.invert(1); Cartesian initialPositionMoonRotating = new Cartesian(); Cartesian initialVelocityMoonRotating = new Cartesian();
The initial guess for the circumlunar free return trajectory is a Lunar flyby that occurs 100 km past the Moon (along the line from the Earth to the Moon).
// Initial state is in moon-centered rotating coordinates to ensure free return conditions. // Units are meters, so this is consistent with a 100 km circumlunar Lunar flyby. initialPositionMoonRotating = new Cartesian(moonPhysicalRadius + 100000.0, 0.0, 0.0); initialVelocityMoonRotating = new Cartesian(0.0, -2400.0, 0.0);
The initial guess for the cislunar free return trajectory is a Lunar flyby that occurs 100 km before the Moon (along the line from the Earth to the Moon).
// Initial state is in moon-centered rotating coordinates to ensure free return conditions. // Units are meters, so this is consistent with a 100 km cislunar Lunar flyby. initialPositionMoonRotating = new Cartesian(-moonPhysicalRadius - 100000.0, 0.0, 0.0); initialVelocityMoonRotating = new Cartesian(0.0, -2400.0, 0.0);
This code is common to both the cislunar and the circumlunar examples. It sets up the force models, propagators, segments, and differential correctors that are used to perform the backward targeting of an initial guess for an Earth parking orbit from the given initial guess for the Lunar flyby conditions. It also runs those differential correctors to actually compute the desired initial guess.
Motion1<Cartesian> initialStateMoonRotating = new Motion1<Cartesian>(initialPositionMoonRotating, initialVelocityMoonRotating); Motion1<Cartesian> initialStateMoonInertial = fromMoonRotatingAtEpoch.transform(initialStateMoonRotating, 1); // Dry mass only because translunar injection maneuver is modeled without // using any propellant mass expenditure model. PropagationScalar dryMass = new PropagationScalar(1000.0); dryMass.setIdentification(dryMassID); dryMass.setScalarDerivative(new ScalarFixed(0.0)); // Create the integrator. RungeKuttaFehlberg78Integrator integrator = new RungeKuttaFehlberg78Integrator(); integrator.setInitialStepSize(60.0); integrator.setMinimumStepSize(1.0); integrator.setMaximumStepSize(86400.0); // Need to define a propagator for the Moon's sphere of influence. PropagationNewtonianPoint propagationPointAroundMoon = new PropagationNewtonianPoint(); propagationPointAroundMoon.setIdentification(motionID); propagationPointAroundMoon.setInitialPosition(initialStateMoonInertial.getValue()); propagationPointAroundMoon.setInitialVelocity(initialStateMoonInertial.getFirstDerivative()); propagationPointAroundMoon.setMass(dryMass.getIntegrationValue()); propagationPointAroundMoon.setIntegrationFrame(moon.getInertialFrame()); // Moon is the primary gravity field. SphericalHarmonicGravityField moonGravityField = new SphericalHarmonicGravityField(moonGravityModel, 4, 4, true, null); SphericalHarmonicGravity moonPrimaryGravity = new SphericalHarmonicGravity(propagationPointAroundMoon.getIntegrationPoint(), moonGravityField); propagationPointAroundMoon.getAppliedForces().add(moonPrimaryGravity); // The Earth and Sun produce third body gravity for Moon propagator. ThirdBodyGravity thirdBodyForMoonPropagator = new ThirdBodyGravity(propagationPointAroundMoon.getIntegrationPoint()); thirdBodyForMoonPropagator.addThirdBody(earth.getName(), earth.getCenterOfMassPoint(), earthGravitationalParameter); thirdBodyForMoonPropagator.addThirdBody(sun.getName(), sun.getCenterOfMassPoint(), sunGravitationalParameter); thirdBodyForMoonPropagator.setCentralBody(moon); propagationPointAroundMoon.getAppliedForces().add(thirdBodyForMoonPropagator); // Make the actual propagator. NumericalPropagatorDefinition nearMoonNumericalPropagator = new NumericalPropagatorDefinition(); // Add the elements. nearMoonNumericalPropagator.getIntegrationElements().add(propagationPointAroundMoon); nearMoonNumericalPropagator.getIntegrationElements().add(dryMass); // Set the integrator. nearMoonNumericalPropagator.setIntegrator(integrator); // Set an epoch. nearMoonNumericalPropagator.setEpoch(epoch); // Make an initial state segment that uses this propagator. NumericalInitialStateSegment initialStateSegment = new NumericalInitialStateSegment(); initialStateSegment.setName("Lunar_Closest_Approach"); initialStateSegment.setPropagatorDefinition(nearMoonNumericalPropagator); // Make a segment that propagates backwards to edge of Lunar sphere of influence (SOI). NumericalPropagatorSegment propagateBackwardToSoi = new NumericalPropagatorSegment(); propagateBackwardToSoi.setName("Propagate_Backward_ToSOI"); propagateBackwardToSoi.setPropagatorDefinition(nearMoonNumericalPropagator); propagateBackwardToSoi.setPropagationDirection(IntegrationSense.DECREASING); propagateBackwardToSoi.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); // Stop propagating this segment at the Lunar SOI boundary. final double moonSemimajorAxis = 384400000.0; // Meters from ssd.jpl.nasa.gov/sats/elem/ // Calculated value is about 66182924 meters. double moonSphereOfInfluence = moonSemimajorAxis * Math.pow(moonGravitationalParameter / earthGravitationalParameter, 0.4); ScalarStoppingCondition moonSoiStoppingCondition = new ScalarStoppingCondition(new ScalarPointElement(propagationPointAroundMoon.getIntegrationPoint(), CartesianElement.MAGNITUDE, moon.getInertialFrame()), moonSphereOfInfluence, 0.0001, // Value tolerance, meters. StopType.ANY_THRESHOLD); moonSoiStoppingCondition.setName("Moon_SOI"); propagateBackwardToSoi.getStoppingConditions().add(moonSoiStoppingCondition); // Make an Earth-centered propagator for any propagation outside the Lunar SOI. // The initial positions and velocity will be provided by the preceding segment, // so it is okay to use Cartesian.Undefined here. PropagationNewtonianPoint propagationPointAroundEarth = new PropagationNewtonianPoint(motionID, earth.getInertialFrame(), Cartesian.getUndefined(), Cartesian.getUndefined()); // Total mass. propagationPointAroundEarth.setMass(dryMass.getIntegrationValue()); // Gravitational field for Earth. SphericalHarmonicGravityField earthGravityField = new SphericalHarmonicGravityField(earthGravityModel, 4, 4, true, new PermanentSolidTideModel()); SphericalHarmonicGravity earthGravityAsPrimary = new SphericalHarmonicGravity(propagationPointAroundEarth.getIntegrationPoint(), earthGravityField); propagationPointAroundEarth.getAppliedForces().add(earthGravityAsPrimary); // The gravity of the Sun and Moon are modeled as third bodies for the Earth-centered propagator. ThirdBodyGravity thirdBodyForEarthPropagator = new ThirdBodyGravity(); thirdBodyForEarthPropagator.setTargetPoint(propagationPointAroundEarth.getIntegrationPoint()); thirdBodyForEarthPropagator.addThirdBody(moon.getName(), moon.getCenterOfMassPoint(), moonGravitationalParameter); thirdBodyForEarthPropagator.addThirdBody(sun.getName(), sun.getCenterOfMassPoint(), sunGravitationalParameter); propagationPointAroundEarth.getAppliedForces().add(thirdBodyForEarthPropagator); // Make the actual propagator. NumericalPropagatorDefinition earthCenteredNumericalPropagator = new NumericalPropagatorDefinition(); // Add the elements. earthCenteredNumericalPropagator.getIntegrationElements().add(propagationPointAroundEarth); earthCenteredNumericalPropagator.getIntegrationElements().add(dryMass); // Set the integrator. earthCenteredNumericalPropagator.setIntegrator(integrator); // Set epoch. earthCenteredNumericalPropagator.setEpoch(epoch); // Make a segment that propagates backward two days using Earth-centered propagator. NumericalPropagatorSegment propagateBackwardTwoDays = new NumericalPropagatorSegment(); propagateBackwardTwoDays.setName("Propagate_Backward_TwoDays"); propagateBackwardTwoDays.setPropagatorDefinition(earthCenteredNumericalPropagator); propagateBackwardTwoDays.setPropagationDirection(IntegrationSense.DECREASING); propagateBackwardTwoDays.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); propagateBackwardTwoDays.getStoppingConditions().add(new DurationStoppingCondition(Duration.fromDays(-2.0))); // Make a segment that propagates backward to perigee. NumericalPropagatorSegment propagateBackwardToPerigee = new NumericalPropagatorSegment(); propagateBackwardToPerigee.setName("Propagate_Backward_ToPerigee"); propagateBackwardToPerigee.setPropagatorDefinition(earthCenteredNumericalPropagator); propagateBackwardToPerigee.setPropagationDirection(IntegrationSense.DECREASING); propagateBackwardToPerigee.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); ScalarStoppingCondition perigeeStoppingCondition1 = new ScalarStoppingCondition(new ScalarPointElement(propagationPointAroundEarth.getIntegrationPoint(), CartesianElement.MAGNITUDE, earth.getInertialFrame()), 0.0001, // Value tolerance, meters. StopType.LOCAL_MINIMUM); perigeeStoppingCondition1.setName("Earth_Perigee_Backwards_Targeting"); propagateBackwardToPerigee.getStoppingConditions().add(perigeeStoppingCondition1); // Set up segments to use backward propagation. TargetedSegmentList backwardSegmentList = new TargetedSegmentList(); backwardSegmentList.setName("Backward_Segment_List"); backwardSegmentList.getSegments().add(initialStateSegment); backwardSegmentList.getSegments().add(propagateBackwardToSoi); backwardSegmentList.getSegments().add(propagateBackwardTwoDays); backwardSegmentList.getSegments().add(propagateBackwardToPerigee); // Two variables are rotating frame y and z velocity directions. // Need to transform from initial to rotating and back inside setter for variable. SetVariableCallback<NumericalPropagatorState> setterVy = SetVariableCallback.of((variable, configuration) -> { Motion1<Cartesian> currentMotion = configuration.getMotion(motionID); Motion1<Cartesian> rotatingMotion = toMoonRotatingAtEpoch.transform(currentMotion, 1); double updatedVy = rotatingMotion.getFirstDerivative().getY() + variable; Motion1<Cartesian> updatedRotating = new Motion1<Cartesian>(rotatingMotion.getValue(), new Cartesian(rotatingMotion.getFirstDerivative().getX(), updatedVy, rotatingMotion.getFirstDerivative().getZ())); Motion1<Cartesian> updatedInertial = fromMoonRotatingAtEpoch.transform(updatedRotating, 1); configuration.modifyMotion(motionID, updatedInertial); }); SegmentPropagatorVariable velocityYVariable = initialStateSegment.createVariable(10.0, // Maximum step, m/s. 0.1, // Perturbation, m/s. setterVy); // Need to transform from initial to rotating and back inside setter for variable. SetVariableCallback<NumericalPropagatorState> setterVz = SetVariableCallback.of((variable, configuration) -> { Motion1<Cartesian> currentMotion = configuration.getMotion(motionID); Motion1<Cartesian> rotatingMotion = toMoonRotatingAtEpoch.transform(currentMotion, 1); double updatedVz = rotatingMotion.getFirstDerivative().getZ() + variable; Motion1<Cartesian> updatedRotating = new Motion1<Cartesian>(rotatingMotion.getValue(), new Cartesian(rotatingMotion.getFirstDerivative().getX(), rotatingMotion.getFirstDerivative().getY(), updatedVz)); Motion1<Cartesian> updatedInertial = fromMoonRotatingAtEpoch.transform(updatedRotating, 1); configuration.modifyMotion(motionID, updatedInertial); }); SegmentPropagatorVariable velocityZVariable = initialStateSegment.createVariable(10.0, // Maximum step, m/s. 0.1, // Perturbation, m/s. setterVz); // Constraints are Earth departure altitude of 241 km and inclination of 28.5 degrees. ScalarPointElement backwardPerigeeRadius = new ScalarPointElement(propagationPointAroundEarth.getIntegrationPoint(), CartesianElement.MAGNITUDE, earth.getInertialFrame()); ScalarAtEndOfNumericalSegmentConstraint backwardPerigeeRadiusConstraint = new ScalarAtEndOfNumericalSegmentConstraint(backwardPerigeeRadius, propagateBackwardToPerigee, earthPhysicalRadius + 241000.0, // Desired value, meters. 0.001, // Tolerance, meters. EndsOfSegment.FINAL); ScalarModifiedKeplerianElement backwardInclination = new ScalarModifiedKeplerianElement(earthGravitationalParameter, propagationPointAroundEarth.getIntegrationPoint(), KeplerianElement.INCLINATION, earth.getInertialFrame()); ScalarAtEndOfNumericalSegmentConstraint backwardInclinationConstraint = new ScalarAtEndOfNumericalSegmentConstraint(backwardInclination, propagateBackwardToPerigee, Trig.degreesToRadians(28.5), Trig.degreesToRadians(0.1), EndsOfSegment.FINAL); TargetedSegmentListDifferentialCorrector correctorBackwardTrajectory = new TargetedSegmentListDifferentialCorrector(); correctorBackwardTrajectory.setName("Correct_Backward_Trajectory"); correctorBackwardTrajectory.setMaximumIterations(75); correctorBackwardTrajectory.setOnlyStoreFinalResults(false); correctorBackwardTrajectory.getConstraints().add(backwardPerigeeRadiusConstraint); correctorBackwardTrajectory.getConstraints().add(backwardInclinationConstraint); correctorBackwardTrajectory.getVariables().add(velocityYVariable); correctorBackwardTrajectory.getVariables().add(velocityZVariable); // Add the differential corrector to the targeted segment list. backwardSegmentList.getOperators().add(correctorBackwardTrajectory); backwardSegmentList.setOperatorAction(TargetedSegmentListOperatorBehavior.RUN_ACTIVE_OPERATORS); // Run backwardSegmentList. SegmentPropagator propagator = backwardSegmentList.getSegmentPropagator(new EvaluatorGroup()); TargetedSegmentListResults listResults = (TargetedSegmentListResults)propagator.propagate(); DateMotionCollection1<Cartesian> barycentricRotatingEphemeris = listResults.getDateMotionCollectionOfOverallTrajectory(motionID, barycentricRotatingFrame); // Barycentric or moon centered inertial ephemeris could also be created here if desired. DateMotionCollection1<Cartesian> earthCenteredInertialEphemeris = listResults.getDateMotionCollectionOfOverallTrajectory(motionID, earth.getInertialFrame()); // Compute translunar injection and parking orbit parameters. Motion1<Cartesian> translunarInjectionState = earthCenteredInertialEphemeris.getMotions().get(0); ModifiedKeplerianElements translunarKeplerianElements = new ModifiedKeplerianElements(translunarInjectionState, earthGravitationalParameter); double translunarInjectionVelocity = translunarInjectionState.getFirstDerivative().getMagnitude(); double parkingOrbitVelocity = Math.sqrt(earthGravitationalParameter / translunarInjectionState.getValue().getMagnitude()); double translunarInjectionDeltaV = translunarInjectionVelocity - parkingOrbitVelocity; Cartesian parkingOrbitVelocityCartesian = Cartesian.multiply(translunarInjectionState.getFirstDerivative(), (parkingOrbitVelocity / translunarInjectionVelocity)); Motion1<Cartesian> parkingOrbitState = new Motion1<Cartesian>(translunarInjectionState.getValue(), parkingOrbitVelocityCartesian); ModifiedKeplerianElements parkingOrbitElements = new ModifiedKeplerianElements(parkingOrbitState, earthGravitationalParameter);
This code is common to both the cislunar and the circumlunar examples. It sets up the force models, propagators, segments, and differential correctors that are used to perform the forward targeting of the Earth re-entry conditions that occur after the Lunar flyby. The parking orbit guess determined in the previous section is varied to target those Earth re-entry conditions.
// Use Earth parking orbit right ascension of the ascending node, true anomaly, and translunar injection delta-v as variables // to target Earth re-entry after the lunar flyby. NumericalInitialStateSegment forwardInitialStateSegment = new NumericalInitialStateSegment(); forwardInitialStateSegment.setName("Forward_Initial_State_Segment"); // Use cloned version of the Earth centered backward propagator that has modified initial state and epoch. NumericalPropagatorDefinition forwardEarthCenteredPropagator = (NumericalPropagatorDefinition) earthCenteredNumericalPropagator.clone(new CopyContext()); forwardEarthCenteredPropagator.setEpoch(earthCenteredInertialEphemeris.getDates().get(0)); PropagationNewtonianPoint forwardEarthCenteredPoint = (PropagationNewtonianPoint)((DefinitionalObjectCollection<PropagationStateElement>)forwardEarthCenteredPropagator.getIntegrationElements()).get(0); forwardEarthCenteredPoint.setInitialPosition(parkingOrbitState.getValue()); forwardEarthCenteredPoint.setInitialVelocity(parkingOrbitState.getFirstDerivative()); forwardInitialStateSegment.setPropagatorDefinition(forwardEarthCenteredPropagator); // The translunar injection from the parking orbit. ImpulsiveManeuverSegment transLunarInjectionSegment = new ImpulsiveManeuverSegment(); transLunarInjectionSegment.setName("Trans-Lunar_Injection"); // The maneuver. ImpulsiveManeuverInformation transLunarBurnDetails = new ImpulsiveManeuverInformation(motionID, new Cartesian(translunarInjectionDeltaV, 0.0, 0.0)); transLunarBurnDetails.setOrientation(new AxesVelocityOrbitNormal(transLunarBurnDetails.getPropagationPoint(), earth)); transLunarInjectionSegment.setManeuver(transLunarBurnDetails); // Right ascension variable. Perturbation values for each of these variables // may need to be modified using trial and error if convergence fails. SetVariableCallback<NumericalPropagatorState> setterRightAscension = SetVariableCallback.of((variable, configuration) -> { Motion1<Cartesian> currentMotion = configuration.getMotion(motionID); ModifiedKeplerianElements oldElements = new ModifiedKeplerianElements(currentMotion, earthGravitationalParameter); ModifiedKeplerianElements newElements = new ModifiedKeplerianElements(oldElements.getRadiusOfPeriapsis(), oldElements.getInverseSemimajorAxis(), oldElements.getInclination(), oldElements.getArgumentOfPeriapsis(), oldElements.getRightAscensionOfAscendingNode() + variable, oldElements.getTrueAnomaly(), earthGravitationalParameter); configuration.modifyMotion(motionID, newElements.toCartesian()); }); SegmentPropagatorVariable rightAscensionVariable = forwardInitialStateSegment.createVariable(Trig.degreesToRadians(0.1), // Maximum step, radians. Trig.degreesToRadians(0.001), // Perturbation, radians. setterRightAscension); rightAscensionVariable.setName("InitialState_RightAscension"); // True anomaly variable. (This is really argument of latitude since the orbit is circular and inclined.) SetVariableCallback<NumericalPropagatorState> setterTrueAnomaly = SetVariableCallback.of((variable, configuration) -> { Motion1<Cartesian> currentMotion = configuration.getMotion(motionID); ModifiedKeplerianElements oldElements = new ModifiedKeplerianElements(currentMotion, earthGravitationalParameter); ModifiedKeplerianElements newElements = new ModifiedKeplerianElements(oldElements.getRadiusOfPeriapsis(), oldElements.getInverseSemimajorAxis(), oldElements.getInclination(), oldElements.getArgumentOfPeriapsis(), oldElements.getRightAscensionOfAscendingNode(), oldElements.getTrueAnomaly() + variable, earthGravitationalParameter); configuration.modifyMotion(motionID, newElements.toCartesian()); }); SegmentPropagatorVariable trueAnomalyVariable = forwardInitialStateSegment.createVariable(Trig.degreesToRadians(0.1), // Maximum step, radians. Trig.degreesToRadians(0.001), // Perturbation, radians. setterTrueAnomaly); trueAnomalyVariable.setName("InitialState_TrueAnomaly"); // Maneuver delta-v variable. SegmentPropagatorVariable translunarInjectionDeltaVxVariable = transLunarInjectionSegment.createVariable(100.0, // Maximum step, m/s. 1.0, // Perturbation, m/s. SetVariableCallback.of((variable, configuration) -> { configuration.getManeuver().setX(configuration.getManeuver().getX() + variable); })); translunarInjectionDeltaVxVariable.setName("TranslunarInjection_ThrustVector_X"); // Make a segment that propagates forward to edge of Lunar SOI. NumericalPropagatorSegment propagateForwardToSoi1 = new NumericalPropagatorSegment(); propagateForwardToSoi1.setName("Propagate_Forward_ToSOI_BeforeFlyby"); propagateForwardToSoi1.setPropagatorDefinition(forwardEarthCenteredPropagator); propagateForwardToSoi1.setPropagationDirection(IntegrationSense.INCREASING); propagateForwardToSoi1.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); // Stopping condition can be reused here. propagateForwardToSoi1.getStoppingConditions().add(moonSoiStoppingCondition); // Make a segment that propagates forward until perilune (closest approach distance to Moon) // using Moon-centered propagator. NumericalPropagatorSegment propagateForwardToPerilune = new NumericalPropagatorSegment(); propagateForwardToPerilune.setName("Propagate_Forward_ToPerilune"); // No need to change initial conditions here because the state and time will be overriden. propagateForwardToPerilune.setPropagatorDefinition(nearMoonNumericalPropagator); propagateForwardToPerilune.setPropagationDirection(IntegrationSense.INCREASING); propagateForwardToPerilune.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); ScalarStoppingCondition periluneStoppingCondition = new ScalarStoppingCondition(new ScalarPointElement(propagationPointAroundMoon.getIntegrationPoint(), CartesianElement.MAGNITUDE, moon.getInertialFrame()), 0.0001, // Value tolerance, meters. StopType.LOCAL_MINIMUM); periluneStoppingCondition.setName("Moon_Perilune"); propagateForwardToPerilune.getStoppingConditions().add(periluneStoppingCondition); // Make a segment that propagates forward to edge of Lunar SOI. NumericalPropagatorSegment propagateForwardToSoi2 = new NumericalPropagatorSegment(); propagateForwardToSoi2.setName("Propagate_Forward_ToSOI_AfterFlyby"); propagateForwardToSoi2.setPropagatorDefinition(nearMoonNumericalPropagator); propagateForwardToSoi2.setPropagationDirection(IntegrationSense.INCREASING); propagateForwardToSoi2.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); // Stopping condition can be reused here. propagateForwardToSoi2.getStoppingConditions().add(moonSoiStoppingCondition); // Make a segment that propagates forward two days. NumericalPropagatorSegment propagateForwardTwoDays = new NumericalPropagatorSegment(); propagateForwardTwoDays.setName("Propagate_Forward_Two_Days"); propagateForwardTwoDays.setPropagatorDefinition(forwardEarthCenteredPropagator); propagateForwardTwoDays.getStoppingConditions().add(new DurationStoppingCondition(Duration.fromDays(2.0))); // Make a segment that propagates forward to perigee or Earth altitude of 122.5 km. NumericalPropagatorSegment propagateForwardToPerigee = new NumericalPropagatorSegment(); propagateForwardToPerigee.setName("Propagate_Backward_ToPerigee"); propagateForwardToPerigee.setPropagatorDefinition(forwardEarthCenteredPropagator); propagateForwardToPerigee.setPropagationDirection(IntegrationSense.INCREASING); propagateForwardToPerigee.setStopOnMaximumDurationBehavior(MaximumDurationBehavior.THROW); ScalarStoppingCondition perigeeStoppingCondition2 = new ScalarStoppingCondition(new ScalarPointElement(forwardEarthCenteredPoint.getIntegrationPoint(), CartesianElement.MAGNITUDE, earth.getInertialFrame()), 0.0001, // Value tolerance, meters. StopType.LOCAL_MINIMUM); perigeeStoppingCondition2.setName("Earth_Perigee_After_Return"); ScalarStoppingCondition altitudeStoppingCondition = new ScalarStoppingCondition(new ScalarPointElement(forwardEarthCenteredPoint.getIntegrationPoint(), CartesianElement.MAGNITUDE, earth.getInertialFrame()), earthPhysicalRadius + 122500.0, // Threshold, meters. 0.0001, // Value tolerance, meters. StopType.ANY_THRESHOLD); altitudeStoppingCondition.setName("Earth_Entry_Altitude"); propagateForwardToPerigee.getStoppingConditions().add(perigeeStoppingCondition2); propagateForwardToPerigee.getStoppingConditions().add(altitudeStoppingCondition); // A re-entry altitude of 120 - 125 km with a flight path angle of between -6 and -7 degrees // are the target conditions for manned re-entry used by Mark Jesick, "AAS 11-452, Abort Options for Human // Missions to Earth-Moon Halo orbits" in Proceedings of the 2011 AAS/AIAA Astrodynamics Conference, // Girdwood, AK, August 2011. // Choosing the midpoint of those ranges gives altitude constraint 125.5 km and flight path angle // constraint of -6.5 degree for re-entry conditions. ScalarPointElement radiusScalar = new ScalarPointElement(forwardEarthCenteredPoint.getIntegrationPoint(), CartesianElement.MAGNITUDE, earth.getInertialFrame()); ScalarAtEndOfNumericalSegmentConstraint altitudeConstraint = new ScalarAtEndOfNumericalSegmentConstraint(radiusScalar, propagateForwardToPerigee, earthPhysicalRadius + 122500.0, // Desired value, meters. 100.0, // Tolerance, meters. EndsOfSegment.FINAL); // Calculating Earth's J2 is needed to get a radial velocity scalar from // the Kozai-Izsak mean elements. double earthJ2 = earthGravityModel.getZonalCoefficients()[2]; earthJ2 = earthGravityModel.getNormalized() ? earthJ2 * Math.sqrt(5.0) : earthJ2; ScalarKozaiIzsakMeanElement radialVelocityScalar = new ScalarKozaiIzsakMeanElement(earthGravitationalParameter, forwardEarthCenteredPoint.getIntegrationPoint(), KozaiIzsakMeanElement.RADIAL_VELOCITY, earth.getInertialFrame(), earthJ2, earthPhysicalRadius); ScalarVectorElement velocityMagnitudeScalar = new ScalarVectorElement(forwardEarthCenteredPoint.getIntegrationPoint().createVectorVelocity(earth.getInertialFrame()), CartesianElement.MAGNITUDE, earth.getInertialFrame().getAxes()); Scalar sineFlightPathAngleScalar = Scalar.divide(radialVelocityScalar, velocityMagnitudeScalar); double desiredSineFlightPathAngle = Math.sin(Trig.degreesToRadians(-6.5)); ScalarAtEndOfNumericalSegmentConstraint flightPathAngleConstraint = new ScalarAtEndOfNumericalSegmentConstraint(sineFlightPathAngleScalar, propagateForwardToPerigee, desiredSineFlightPathAngle, // Desired value, radians. 0.001, // Tolerance, radians. EndsOfSegment.FINAL); // Set up segments to use forward propagation. TargetedSegmentList forwardSegmentList = new TargetedSegmentList(); forwardSegmentList.setName("Forward_Segment_List"); forwardSegmentList.getSegments().add(forwardInitialStateSegment); forwardSegmentList.getSegments().add(transLunarInjectionSegment); forwardSegmentList.getSegments().add(propagateForwardToSoi1); forwardSegmentList.getSegments().add(propagateForwardToPerilune); forwardSegmentList.getSegments().add(propagateForwardToSoi2); forwardSegmentList.getSegments().add(propagateForwardTwoDays); forwardSegmentList.getSegments().add(propagateForwardToPerigee); TargetedSegmentListDifferentialCorrector altitudeCorrectorForwardTrajectory = new TargetedSegmentListDifferentialCorrector(); altitudeCorrectorForwardTrajectory.setName("Correct_Forward_Trajectory_Altitude"); altitudeCorrectorForwardTrajectory.getVariables().add(rightAscensionVariable); altitudeCorrectorForwardTrajectory.getVariables().add(trueAnomalyVariable); altitudeCorrectorForwardTrajectory.getVariables().add(translunarInjectionDeltaVxVariable); altitudeCorrectorForwardTrajectory.getConstraints().add(altitudeConstraint); altitudeCorrectorForwardTrajectory.setMaximumIterations(25); altitudeCorrectorForwardTrajectory.setOnlyStoreFinalResults(false); forwardSegmentList.getOperators().add(altitudeCorrectorForwardTrajectory); TargetedSegmentListDifferentialCorrector flightPathCorrectorForwardTrajectory = new TargetedSegmentListDifferentialCorrector(); flightPathCorrectorForwardTrajectory.setName("Correct_Forward_Trajectory_FlightPath"); flightPathCorrectorForwardTrajectory.getVariables().add(rightAscensionVariable); flightPathCorrectorForwardTrajectory.getVariables().add(trueAnomalyVariable); flightPathCorrectorForwardTrajectory.getVariables().add(translunarInjectionDeltaVxVariable); flightPathCorrectorForwardTrajectory.getConstraints().add(altitudeConstraint); flightPathCorrectorForwardTrajectory.getConstraints().add(flightPathAngleConstraint); flightPathCorrectorForwardTrajectory.setMaximumIterations(25); flightPathCorrectorForwardTrajectory.setOnlyStoreFinalResults(false); forwardSegmentList.getOperators().add(flightPathCorrectorForwardTrajectory);
This section demonstrates how to run the circumlunar and cislunar free-return forward targeters that were created above. After the runs are complete, the results are extracted and tabulated below.
// Run forwardSegmentList. SegmentPropagator forwardPropagator = forwardSegmentList.getSegmentPropagator(new EvaluatorGroup()); TargetedSegmentListResults forwardListResults = (TargetedSegmentListResults) forwardPropagator.propagate(); DateMotionCollection1<Cartesian> forwardEarthCenteredInertialEphemeris = forwardListResults.getDateMotionCollectionOfOverallTrajectory(motionID, earth.getInertialFrame()); DateMotionCollection1<Cartesian> forwardEarthFixedEphemeris = forwardListResults.getDateMotionCollectionOfOverallTrajectory(motionID, earth.getFixedFrame()); // Note that it is also possible to create ephemeris in the barycentric rotating frame // and the Moon-centered inertial frame. // Get updated Earth parking orbit state and elements. Motion1<Cartesian> updatedParkingOrbitState = forwardEarthCenteredInertialEphemeris.getMotions().get(0); ModifiedKeplerianElements updatedParkingOrbitElements = new ModifiedKeplerianElements(updatedParkingOrbitState, earthGravitationalParameter); JulianDate parkingOrbitEpoch = forwardEarthCenteredInertialEphemeris.getDates().get(0); double parkingOrbitSemimajorAxis = 1.0 / updatedParkingOrbitElements.getInverseSemimajorAxis(); double parkingOrbitEccentricity = updatedParkingOrbitElements.computeEccentricity(); double parkingOrbitInclination = Trig.radiansToDegrees(updatedParkingOrbitElements.getInclination()); double parkingOrbitArgumentPerigee = Trig.radiansToDegrees(updatedParkingOrbitElements.getArgumentOfPeriapsis()); double updatedRaan = Trig.radiansToDegrees(updatedParkingOrbitElements.getRightAscensionOfAscendingNode()); double updatedTrueAnomaly = Trig.radiansToDegrees(updatedParkingOrbitElements.getTrueAnomaly()); Motion1<Cartesian> updatedTranslunarInjectionState = forwardEarthCenteredInertialEphemeris.getMotions().get(1); Cartesian updatedTranslunarInjectionDeltaV = Cartesian.subtract(updatedTranslunarInjectionState.getFirstDerivative(), updatedParkingOrbitState.getFirstDerivative()); double updatedDeltaVMagnitude = updatedTranslunarInjectionDeltaV.getMagnitude(); // Get lunar flyby state and elements. SegmentResults propagateToPeriluneResults = forwardListResults.getResultsOfSegment(propagateForwardToPerilune); if (propagateToPeriluneResults != null) { JulianDate periluneDate = propagateToPeriluneResults.getFinalPropagatedState().getCurrentDate(); Motion1<Cartesian> periluneState = propagateToPeriluneResults.getFinalPropagatedState().<Cartesian> getMotion(motionID); ModifiedKeplerianElements periluneElements = new ModifiedKeplerianElements(periluneState, moonGravitationalParameter); double lunarFlybyAltitude = periluneElements.getRadiusOfPeriapsis() - moonPhysicalRadius; } // Get Earth re-entry state and elements. int forwardCount = forwardEarthCenteredInertialEphemeris.getCount(); Motion1<Cartesian> earthReentryState = forwardEarthCenteredInertialEphemeris.getMotions().get(forwardCount - 1); Cartesian earthFixedPosition = forwardEarthFixedEphemeris.getValues().get(forwardCount - 1); ModifiedKeplerianElements earthReentryElements = new ModifiedKeplerianElements(earthReentryState, earthGravitationalParameter); JulianDate earthReentryDate = forwardEarthCenteredInertialEphemeris.getDates().get(forwardCount - 1); Cartographic earthReentryCartographic = earth.getShape().cartesianToCartographic(earthFixedPosition); double altitude = earthReentryCartographic.getHeight(); double latitude = Trig.radiansToDegrees(earthReentryCartographic.getLatitude()); double longitude = Trig.radiansToDegrees(earthReentryCartographic.getLongitude()); double eccentricity = earthReentryElements.computeEccentricity(); double trueAnomaly = earthReentryElements.getTrueAnomaly(); double sineTrueAnomaly = Math.sin(trueAnomaly); double cosineTrueAnomaly = Math.cos(trueAnomaly); double sineFlightPathAngle = eccentricity * sineTrueAnomaly / Math.sqrt(1.0 + 2.0 * eccentricity * cosineTrueAnomaly + eccentricity * eccentricity); double flightPathAngle = Trig.radiansToDegrees(Math.asin(sineFlightPathAngle));
Parameters | Circumlunar Results | Cislunar Results |
Parking Orbit Epoch | 12/29/2022 4:05:14 UTCG | 12/19/2022 10:44:28 UTCG |
Parking Orbit Inclination | 28.5 degrees | 28.5 degrees |
Parking Orbit RAAN | 8.59 degrees | 8.37 degrees |
Parking Orbit True Anomaly | 90.00 degrees | -89.94 degrees |
Translunar Injection Delta-v | 3154.8 m/s | 3148.0 m/s |
Lunar Flyby Epoch | 1/1/2023 00:01:20 UTCG | 1/1/2023 00:13:01 UTCG |
Lunar Flyby Altitude | 145 km | 373 km |
Earth Re-entry Epoch | 1/4/2023 00:29:47 UTCG | 1/14/2023 4:34:32 UTCG |
Earth Re-entry Altitude | 122.5 km | 122.9 km |
Earth Re-entry Latitude | 1.6 degrees South | 8.1 degrees South |
Earth Re-entry Longitude | 81.32 degrees East | 23.08 degrees East |
Earth Re-entry Flight Path Angle | -6.46 degrees | -6.54 degrees |
Any high-fidelity mission design would require spacecraft-specific atmospheric drag and solar radiation pressure parameters. These parameters would be used as inputs for the solar radiation force and atmospheric drag models that are available in DME Component Libraries. Any propagator with atmospheric drag should only be active within 1000 km of Earth's surface. Solar radiation pressure should be added to all propagators because it is likely the largest un-modeled force in the above example code.
Spacecraft-specific dry mass, propellant mass, and specific impulse would also need to be provided to model the propellant mass expenditure of translunar injection maneuver.
Targeting and optimization are tricky for free returns because both the launch conditions and the re-entry conditions are often heavily constrained. This example assumed a 90-degree azimuth Cape Canaveral launch with an inclination of 28.5 degrees. The geographical areas where re-entry occurs may also be important if a manned vehicle can only land in the ocean or on specific land areas.