JackCrusoe47 / CR3BP_MATLAB_Library

A MATLAB library for solving Circular Restricted Three-Body Problems
MIT License
14 stars 3 forks source link

beg for code update #1

Open Apnea2xl opened 1 year ago

Apnea2xl commented 1 year ago

Hello, I am a student who has just come into contact with celestial mechanics. Recently, I have been reading the relevant papers of NRHO, but I can find few specific implementations. I have benefited a lot from seeing your creation. Compared with your paper, it seems that the implementation of NRHO track is not included in the example. My code ability is weak. I beg you to update some previously used code into the example. Thank you very much!

JackCrusoe47 commented 1 year ago

Hi

Apologies for getting back to you so late. I've been bit busy at work.

I will go through my old codes and add more case to the library this weekend.

⁣kind regards Kevin

On 10 Feb 2023, 14:31, at 14:31, Apnea2xl @.***> wrote:

Hello, I am a student who has just come into contact with celestial mechanics. Recently, I have been reading the relevant papers of NRHO, but I can find few specific implementations. I have benefited a lot from seeing your creation. Compared with your paper, it seems that the implementation of NRHO track is not included in the example. My code ability is weak. I beg you to update some previously used code into the example. Thank you very much!

-- Reply to this email directly or view it on GitHub: https://github.com/JackCrusoe47/CR3BP_MATLAB_Library/issues/1 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

Apnea2xl commented 1 year ago

It's a great honor to get your reply. Sorry to let you take time out of your busy schedule to update your code. I'm looking forward to it. best wishes

JackCrusoe47 commented 1 year ago

Hi,

Firstly, all the codes you find here are mostly written based on papers by Grebow and Howell, Perdue University. I highly recommend the following thesis.

Generating Periodic Orbits In The Circular Restricted Three-body Problem With Application To Lunar South Pole Coverage -Daniel J. Grebow, K. C. Howell

I was going through the examples in the repo and believe the following files contain NRHO halo orbits.

Near Rectilinear Halo Orbits (NRHO) are special cases of regular halo orbits, and examples of Earth-Moon Northern L1/L2 NRHO can be found in the following files:

These scripts first estimate a Halo orbit, given an initial guess, and then find other nearby halo orbits of the family through a process called pseudo arclength continuation. This includes the NRHO segment of the family as well. To understand when a regular halo orbit turns into NRHO, you could look at the values of their stability parameters (eigenvalues). Once an orbit is generated, the monodromy matrix (M) can be used analyzed to understand the stability characteristics of a periodic orbit:

% - Stability Analysis [nu,k] = getStability_CR3BP(M);

Besides these, the CR3BP directory contains additional functions for generating a few analytical initial guesses for halo orbits. I believe there are first-order and third-order models that can be generated from the required characteristics of halo orbits, which can then be used to generate actual halo orbits through differential correction.

Refer to the following functions:

Apnea2xl commented 1 year ago

Thank you for your guidance, I think I should know how to divide NRHO. But I modified the six-dimensional vector and period of the initial input many times, and found that the generated NRHO periods with orbital stability of 1 are only 1 to 1.3 and 2 to 2.3, which is different from the NRHO in many papers I have seen. Another problem that bothers me the most is how to convert to natural orbit. In your code, I seem to see some ephemeris parameters like Right accension in coordinate conversion.

JackCrusoe47 commented 1 year ago

Hi,

Apologies again for replying so late. I do have to admit that I have not dealt with CR3BP in almost two years and am probably rusty.

Regarding your comment on NRHO orbits being generated only between the stability of 1 to 1.3 and 2 to 2.3, I'll need to double-check why that's the case and get back to you when I can. I remember I used two different stability standards in this codebase:

  1. Traditional stability index: nu = 1/2(|lamda_U|+|lamda_S|) [D. J. Grebow, H. C. Howel]
  2. Alternate stability index: k [LOW-ENERGY LUNAR TRAJECTORY DESIGN - Jeffrey S. Parker and Rodney L. Anderson]

I need to check how my continuation scheme was coded to see if there is a reason for the behavior you observed.

On the point of converting to natural orbits, there are two possible points here. The codes you referred to in your comment are to compute complex orbits in the CR3BP system using multiple shooting, if they are too sensitive for a single shooting scheme to compute. Of course, by this virtue, they are also able to find quasi-periodic or lissajous orbits. But they are still not converting your CR3BP orbits in the Ephemeris system.

An example use case of those codes is as follows:

But if your aim is to convert your ideal trajectory in the CR3BP system to a higher fidelity model (Ephemeris system), the strategy I have used is as follows:

  1. Transform CR3BP solution (trajectory) to Inertial frame: This step simply translates your states from the rotational frame to the inertial frame. It does not really change the solution to the new dynamics (if you are using real dynamics and not assuming the Earth-Moon system to be a simple 2-body problem with the moon in a circular orbit around the Earth) and thus your orbits are no longer periodic and may even diverge.

    I have two scripts to do this transformation.

    • CR3BP2Inertial.m (simple transformation) Note: Since the CR3BP is a rotating frame on the orbital plane of the secondary body, to transform the solution to an inertial frame, you could first convert the solution to the secondary body's peri-focal frame, and then convert it to the final inertial frame. So the inputs (inclination, RAAN, and AOP) are orbital elements of the secondary body and not of your object. So for the Earth-Moon system, these values correspond to the osculating RAAN, inclination, and AOP of the Moon. Apologies for this confusion.
    • _CR3BP2EphemerisCR3BP.m (using spice) Note: In this case, NASA SPICE is used internally to get the current inertial state vector of both your primary and secondary body and then this is used to perform the transformation from CR3BP to the inertial frame. This code is more accurate.
  2. Next you need to recorrect your solution to target the required properties (like being periodic) in your new dynamics.

This can be performed by using a new single or multiple shooting correction scheme that is written from your real inertial high-fidelity system (not CR3BP). It involves writing the dynamics and STM of your real dynamics (J2 or spherical harmonics, 3rd body gravity, etc...) and writing a shooting or correction scheme in the inertial frame. Unfortunately, this is not part of this code base and is a bit more involved. I suggest reading through H.C.Howel's papers. I'll link one that I used if from my past work if I can find it again.

Finally, regarding these functions:

CR3BP/analyticalFirstOrder_amplitudeUW.m CR3BP/analyticalFirstOrder_amplitudeVW.m CR3BP/analyticalFirstOrder_positionUVW.m CR3BP/analyticalThirdOrder_halo.m

They are simple scripts that give you initial guesses for just the Lyapunov and Halo orbit around L1, L2, and L3. These are used as possible starting points when no initial guess exists for those orbits specified. In this code-based, I have used the initial guesses provided by Grebow in his Master Thesis and not these codes, but are provided just for reference.