Skip to content

Commit

Permalink
Merge pull request #127 from mlooz/feature/solar-orbiter
Browse files Browse the repository at this point in the history
Feature/solar orbiter
  • Loading branch information
darioizzo authored Oct 2, 2021
2 parents 7099a3f + f138a4b commit b410363
Show file tree
Hide file tree
Showing 9 changed files with 7,532 additions and 8 deletions.
6,383 changes: 6,383 additions & 0 deletions doc/sphinx/examples/solar_orbiter.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/keplerian_toolbox/core_functions/fb_prop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
* \param[in] v_in inertial velocity before encounter (cartesian)
* \param[in] v_pla inertial velocity of the planet at encounter (cartesian)
* \param[in] rp periplanet radius of the planetocentric hyperbola
* \param[out] beta determines the hyperbola orbit plane orientation
* \param[out] mu planet gravitationa parameter
* \param[in] beta determines the hyperbola orbit plane orientation
* \param[in] mu planet gravitationa parameter
*
* @see
* http://www.esa.int/gsp/ACT/doc/MAD/pub/ACT-RPR-MAD-2010-(CambridgePress)GlobalOptimizationAndSpacePruningForSpacecraftTrajectoryDesign.pdf
Expand Down
14 changes: 11 additions & 3 deletions pykep/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#endif

#if PY_MAJOR_VERSION < 3
#error Minimum supported Python version is 2.6.
#error Minimum supported Python version is 3.
#endif

#include <boost/math/constants/constants.hpp>
Expand Down Expand Up @@ -517,8 +517,12 @@ BOOST_PYTHON_MODULE(core)
"- v: velocity (cartesian)\n"
"- mu: gravity parameter\n\n"
"Returns the osculating keplerian elements a,e,i,W,w,E\n"
"a is the semi-major axis, always a positive quantity.\n"
"e is the eccentricity, non-negative\n"
"i is the incliniation\n"
"W is the longitude of the ascending node, undefined in an equatorial orbit\n"
"w is the argument of perigee, undefined in a circular orbit\n"
"E is the eccentric anomaly for e<1, the Gudermannian for e>1\n"
"a is the semi-major axis always a positive quantity.\n"
"NOTE: The routine is singular when the elements are not defined.\n"
"Example:: \n\n"
" el = ic2par([1,0,0],[0,1,0],1.0)",
Expand All @@ -529,8 +533,12 @@ BOOST_PYTHON_MODULE(core)
"- E: osculating keplerian elements a,e,i,W,w,E ( l, ND, rad, rad, rad, rad)\n"
"- mu: gravity parameter (l^3/s^2)\n\n"
"Returns cartesian elements from Keplerian elements\n"
"a is the semi-major axis, always a positive quantity.\n"
"e is the eccentricity, non-negative\n"
"i is the incliniation\n"
"W is the longitude of the ascending node\n"
"w is the argument of perigee\n"
"E is the eccentric anomaly for e<1, the Gudermannian for e>1\n"
"a is the semi-major axis always a positive quantity.\n"
"Example:: \n\n"
" r, v = pk.par2ic([1,0.3,0.1,0.1,0.2,0.2], 1)",
(arg("E"), arg("mu") = 1.0));
Expand Down
24 changes: 24 additions & 0 deletions pykep/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def runTest(self):
self.run_tandem_test()
self.run_juice_test()
self.run_messenger_test()
self.run_solar_orbiter_test()

def run_rosetta_test(self):
from .trajopt import gym
Expand Down Expand Up @@ -249,6 +250,29 @@ def run_messenger_test(self):
9.02984391e-01, 5.38436770e+02]
self.assertAlmostEqual(udp.fitness(x)[0], 5855.8143406005165)

def run_solar_orbiter_test(self):
from .trajopt import gym
udp = gym.solar_orbiter
x = [5150.7372, 838.744594, 423.725529, 542.888932,
786.972151, 689.379137, 689.367866, 405.891356,
490.36507, 814.464243, 2.11941309, 1.05783213]
old_fitness = udp.fitness(x)
self.assertAlmostEqual(old_fitness[0], 1.8437399239490322)

udp = gym.solar_orbiter_1dsm
x = [7342.0, 0.14120411251056492, 0.4237723295636071, 5258.156830592356,
0.6300665073310685, 324.0,
-5.76656131, 2.48737299, 0.1, 225.0,
5.00867031, 2.32148522, 0.3521748460245339, 110.0,
-4.50716331, 1.0689289, 0.1, 281.0,
-5.44279107, 1.86098904, 0.5933742736159363, 899,
0.55221244, 1.09450385, 0.5255737976858433, 674,
0.75633857, 1.05797006, 0.36486279857122045, 449,
-5.98270464, 1.05787804, 0.3640453532964525, 449,
-6.09420675, 1.05864758, 0.387330295393306, 449,
0.5987826849271193, 1.0641086817294465]
old_fitness = udp.fitness(x)
self.assertAlmostEqual(old_fitness[0], 1.219085231166766)

class spherical_harmonics_loader_test_case(_ut.TestCase):
"""Test case for the spherical harmonic gravity file loader function.
Expand Down
23 changes: 22 additions & 1 deletion pykep/trajopt/_launchers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from scipy.interpolate import interp2d
from scipy.interpolate import interp2d, interp1d
from math import sqrt

_vinfs_A5 = [0., 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6]
_decls_A5 = [-90, -40, -30, -29, -28.5, -20, -10, 0, 10, 20, 28.5, 29, 30, 40, 90]
Expand All @@ -20,6 +21,9 @@
[1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1, 1e-1]
]

_vinfs_A551 = [sqrt(elem) for elem in [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 40, 45, 50, 55, 60]]
_data_A551 = [5995, 5780, 5570, 5360, 5160, 4965, 4775, 4585, 4405, 4230, 4055, 3890, 3730, 3570, 3420, 3270, 3130, 2995, 2860, 2670, 2380, 2120, 1900, 1695]

_vinfs_SF = [0, 1, 2, 3, 4, 5]
_decls_SF = [-90, -65, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50, 65, 90]
_data_SF = [
Expand Down Expand Up @@ -89,6 +93,7 @@ class _launchers:
"""
def __init__(self):
self._atlas501 = interp2d(_vinfs_A5, _decls_A5, _data_A5, kind='linear', fill_value=0.1, copy=False)
self._atlas551 = interp1d(_vinfs_A551, _data_A551, kind='linear', fill_value=0.1, copy=False, bounds_error=False)
self._soyuzf = interp2d(_vinfs_SF, _decls_SF, _data_SF, kind='linear', fill_value=1e-3, copy=False)
self._ariane5 = interp2d(_vinfs_Ariane5, _decls_Ariane5, _data_Ariane5, kind='linear', fill_value=1e-3, copy=False)
def atlas501(self, vinfs, decls):
Expand All @@ -106,6 +111,22 @@ def atlas501(self, vinfs, decls):
"""
return self._atlas501(vinfs, decls)

def atlas551(self, vinfs):
"""atlas551(vinfs)
Computes the mass that the Atlas 551 launcher can deliver to a certain vinf
If the inputs are arrays, then a mesh is considered and the mass is returned on points of the mesh
Args:
- vinfs (``float`` or array-like): the hyperbolic escape velocity in km/s
Returns:
Numpy array containg the mass delivered to escape with said magnitudes.
"""
return self._atlas551(vinfs)

def soyuzf(self, vinfs, decls):
"""soyuzf(vinfs, decls)
Expand Down
1 change: 1 addition & 0 deletions pykep/trajopt/gym/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
INSTALL(FILES __init__.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _tandem.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _juice.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _solar_orbiter.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _cassini1.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _rosetta.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
INSTALL(FILES _emNimp.py DESTINATION ${PYKEP_INSTALL_PATH}/trajopt/gym)
Expand Down
2 changes: 1 addition & 1 deletion pykep/trajopt/gym/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from ._emNimp import em3imp, em5imp, em7imp
from ._eve_mga1dsm import eve_mga1dsm, eve_mga1dsm_a, eve_mga1dsm_n
from ._messenger import messenger

from ._solar_orbiter import solar_orbiter, solar_orbiter_resdsm, solar_orbiter_1dsm, solar_orbiter_evolve_rev
2 changes: 1 addition & 1 deletion pykep/trajopt/gym/_juice.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class _juice_udp(mga_1dsm):
"""
This class represents a rendezvous mission to Jupiter modelled as an MGA-1DSM transfer. The selected fly-by sequence,
E-EVEME-J, and other parameters are inspired to the ESA Juice mission. A launcher model is included, namely an Ariane5
E-EVEME-J, and other parameters are inspired by the ESA Juice mission. A launcher model is included, namely an Ariane5
launch from Kourou.
JUICE - JUpiter ICy moons Explorer - is the first large-class mission in ESA's Cosmic Vision 2015-2025 programme.
Planned for launch in 2022 and arrival at Jupiter in 2029, it will spend at least three years making detailed
Expand Down
Loading

0 comments on commit b410363

Please sign in to comment.