uc3m-aerospace / MOLTO-IT

Multi-Objective Low-Thrust Optimizer for Interplanetary Transfers
MIT License
32 stars 11 forks source link

Trajectory Plot not matching the rendezvous #22

Open Ernest6 opened 3 years ago

Ernest6 commented 3 years ago

Hello,

I have been using this sofware to have a first insight on the optimal trajectory to rendevouz with an asteroid (3deg inclination) from Earth. In order to better visualize the results I decided to add the orbit trajectory both bodies, in addition to the Spacecraft one provided by the optimizer, using the same PSK files provided to the solver. However, when doing so, I have seen that sometimes the final position of the transfer trajectory do not match the one of the target (so is not doing the rendevouz properly, i guess).

To make more clear my point here I add two images, in which all the input parameters are the same except for the v_inf escaping the Earth. Green is Earht, red is Mars, and yellow is the asteroid.

Using Vinf = 5 km/s (There is a clear mismatch) UnmatchedAsteroid

Using Vinf = 3km/s (Still there is a missmatch but not so obvious) NearlyMatchedAsteroid

The way these additional lines are plotted is by taking the state vector of the different bodies, given in the J2000 Ecliptical, and projecting them in them in the x-y plane, as the document that explain MOLTO suggest (and is a bit outdated). I have also tried to do the figure by setting the inclination of the asteroid orbit to 0, that is, 'de-tilting' the orbit, and therefore keeping the eccentricity and semimajor axis equal to the real orbit, but there is no improvement.

I would like to know if this is probably an error of the optimizer, or there is some internal manipulation of the orbit by the software that I am not aware of and should take into account when plotting.

Regards.

PD: I have another question about the outputs of the _fitnessnsga2 funtion. Could you provide an explanation about what does each variable (and each of its columns if matrix) means? Im talking about the three of them (Obj, Cons, outdata) but specially about he columns of outdata.

su101195 commented 3 years ago

@Ernest6 Any idea on how you were able to plot the Earth and Mars orbit?

Ernest6 commented 3 years ago

@su101195 I have modified the part of the code in charge of doing the plots quite a bit since I did that drawing. However, I can give you some guidelines that I think should be enough to do that figure.

First of all go to the molto_it.m function and comment the line that closes the figure (line 309 - close (hh);). Then on a separate code load the state vectors of the different bodies you want to plot (remember to include those bodies when loading the kernels). To do so you can use the mice library and some of its functions:

Then you can plot the first two rows (x,y coordinates) of the obtained matrix for each of the bodies in the previous figure you didn't close (State vector is in km, and molto plot in AU).

et0 = cspice_str2et('2020 Jan 01'); etall = et0+[0:3600*24:((365.25*3600*24)*2)]; %2 years [statearth, ~] = cspice_spkezr('3',etall,'ECLIPJ2000','NONE','0'); plot(statearth(1,:)/149597870.7,statearth(2,:)/149597870.7,'g','Linewidth',2)