Exemplo n.º 1
0
    def __init__(
            self,
            mass=1000,
            Tmax=0.05,
            Isp=2500,
            Vinf_0=3,
            Vinf_f=1e-12,
            nseg=10,
            departure=None,
            target=None,
            optimise4mass=False):
        """
        Constructs a low-thrust transfer between a departure planet and a target planet (Constrained Continuous Single-Objective)

        NOTE: An impulsive transcription is used to transform into an NLP the Optimal Control Problem

        USAGE: problem.py_pl2pl(self,mass=1000,Tmax=0.05,Isp=2500,Vinf_0=3,Vinf_f=0,nseg=10,departure = PyKEP.planet_ss('earth'), target = PyKEP.planet_ss('mars'))

        * mass: spacecraft mass at departure [kg]
        * Tmax: maximum allowed thrust [N]
        * Isp: spacecarft engine specific impulse [Isp]
        * Vinf_0: allowed maximum starting velocity [km/s]
        * Vinf_f: allowed maximum arrival velocity [km/s]
                  (if negative it is interpreted as a minimum arrival velocity)
        * nseg: number of segments used for the impulsive transcription
        * departure: departure planet (a PyKEP planet)
        * target: arrival planet (a PyKEP planet)
        """
        try:
            import PyKEP
        except ImportError:
            raise ImportError(
                "Error while trying 'import PyKEP': is PyKEP installed?")
        if departure is None:
            departure = PyKEP.planet_ss('earth')
        if target is None:
            target = mars = PyKEP.planet_ss('mars')
        super(py_pl2pl, self).__init__(
            9 + nseg * 3, 0, 1, 9 + nseg, nseg + 2, 1e-5)
        self.__departure = departure
        self.__target = target
        self.__sc = PyKEP.sims_flanagan.spacecraft(mass, Tmax, Isp)
        self.__Vinf_0 = Vinf_0 * 1000
        self.__Vinf_f = Vinf_f * 1000
        self.__leg = PyKEP.sims_flanagan.leg()
        self.__leg.set_mu(departure.mu_central_body)
        self.__leg.set_spacecraft(self.__sc)
        self.__nseg = nseg
        self.set_bounds(
            [0, 10, self.__sc.mass / 10, -abs(self.__Vinf_0),
             -abs(self.__Vinf_0), -abs(self.__Vinf_0), -abs(self.__Vinf_f),
             -abs(self.__Vinf_f), -abs(self.__Vinf_f)] + [-1] * 3 * nseg,
            [3000, 1500, self.__sc.mass, abs(self.__Vinf_0),
             abs(self.__Vinf_0), abs(self.__Vinf_0), abs(self.__Vinf_f), 
             abs(self.__Vinf_f), abs(self.__Vinf_f)] + [1] * 3 * nseg)
        self.__optimise4mass = optimise4mass
Exemplo n.º 2
0
 def __init__(self,
              mass=1000,
              Tmax=0.05,
              Isp=2500,
              Vinf_0=3,
              Vinf_f=0,
              nseg=10,
              departure=None,
              target=None,
              optimise4mass=False):
     """__init__(self,mass=1000,Tmax=0.05,Isp=2500,Vinf_0=3,Vinf_f=0,nseg=10,departure = erath, target = mars)"""
     try:
         import PyKEP
     except ImportError:
         print("Error while trying 'import PyKEP': is PyKEP installed?")
         raise
     if departure is None:
         departure = PyKEP.planet_ss('earth')
     if target is None:
         target = mars = PyKEP.planet_ss('mars')
     super(py_pl2pl, self).__init__(9 + nseg * 3, 0, 1, 9 + nseg, nseg + 2,
                                    1e-5)
     self.__departure = departure
     self.__target = target
     self.__sc = PyKEP.sims_flanagan.spacecraft(mass, Tmax, Isp)
     self.__Vinf_0 = Vinf_0 * 1000
     self.__Vinf_f = Vinf_f * 1000
     self.__leg = PyKEP.sims_flanagan.leg()
     self.__leg.set_mu(PyKEP.MU_SUN)
     self.__leg.set_spacecraft(self.__sc)
     self.__nseg = nseg
     self.set_bounds([
         0, 10, self.__sc.mass / 10, -abs(self.__Vinf_0),
         -abs(self.__Vinf_0), -abs(self.__Vinf_0), -abs(self.__Vinf_f),
         -abs(self.__Vinf_f), -abs(self.__Vinf_f)
     ] + [-1] * 3 * nseg, [
         3000, 1500, self.__sc.mass,
         abs(self.__Vinf_0),
         abs(self.__Vinf_0),
         abs(self.__Vinf_0),
         abs(self.__Vinf_f),
         abs(self.__Vinf_f),
         abs(self.__Vinf_f)
     ] + [1] * 3 * nseg)
     self.__optimise4mass = optimise4mass
Exemplo n.º 3
0
	def __init__(self,mass=1000,Tmax=0.05,Isp=2500,Vinf_0=3,Vinf_f=0,nseg=10,departure = None, target = None, optimise4mass = False):
		"""__init__(self,mass=1000,Tmax=0.05,Isp=2500,Vinf_0=3,Vinf_f=0,nseg=10,departure = erath, target = mars)"""
		try:
			import PyKEP
		except ImportError:
			print("Error while trying 'import PyKEP': is PyKEP installed?")
			raise
		if departure is None:
			departure = PyKEP.planet_ss('earth')
		if target is None:
			target = mars = PyKEP.planet_ss('mars')
		super(py_pl2pl,self).__init__(9 + nseg*3,0,1,9 + nseg,nseg+2,1e-5)
		self.__departure = departure
		self.__target = target
		self.__sc = PyKEP.sims_flanagan.spacecraft(mass,Tmax,Isp)
		self.__Vinf_0 = Vinf_0*1000
		self.__Vinf_f = Vinf_f*1000
		self.__leg = PyKEP.sims_flanagan.leg()
		self.__leg.set_mu(PyKEP.MU_SUN)
		self.__leg.set_spacecraft(self.__sc)
		self.__nseg = nseg
		self.set_bounds([0,10,self.__sc.mass/10,-abs(self.__Vinf_0),-abs(self.__Vinf_0),-abs(self.__Vinf_0),-abs(self.__Vinf_f),-abs(self.__Vinf_f),-abs(self.__Vinf_f)] + [-1] * 3 *nseg,[3000,1500,self.__sc.mass,abs(self.__Vinf_0),abs(self.__Vinf_0),abs(self.__Vinf_0),abs(self.__Vinf_f),abs(self.__Vinf_f),abs(self.__Vinf_f)] + [1] * 3 * nseg)
		self.__optimise4mass = optimise4mass
Exemplo n.º 4
0
def jde_mga_1dsm(seq, t0, tof, slack=5, pop_size=50, n_evolve=10, dv_launch=6127., verbose=False):
    """Runs jDE with mga_1dsm problem."""
    from PyGMO.problem import mga_1dsm_tof
    from PyGMO.algorithm import jde
    from PyGMO import population

    prob = mga_1dsm_tof(seq=[kep.planet_ss(name) for name in seq],
                                   t0=[kep.epoch(t0-slack), kep.epoch(t0+slack)],
                                   tof=[[t-slack, t+slack] for t in tof],
                                   vinf=[0., dv_launch/1000.],
                                   add_vinf_arr=False)
    algo = jde(gen=500, memory=True)
    pop = population(prob, pop_size)
    if verbose:
        print pop.champion.f[0]
    for i in xrange(n_evolve):
        pop = algo.evolve(pop)
        if verbose:
            print pop.champion.f
Exemplo n.º 5
0
    def __init__(self,
                 mass=1000,
                 Tmax=0.05,
                 Isp=2500,
                 Vinf_0=3,
                 Vinf_f=1e-12,
                 nseg=10,
                 departure=None,
                 target=None,
                 optimise4mass=False):
        """
        Constructs a low-thrust transfer between a departure planet and a target planet (Constrained Continuous Single-Objective)

        NOTE: An impulsive transcription is used to transform into an NLP the Optimal Control Problem

        USAGE: problem.py_pl2pl(self,mass=1000,Tmax=0.05,Isp=2500,Vinf_0=3,Vinf_f=0,nseg=10,departure = PyKEP.planet_ss('earth'), target = PyKEP.planet_ss('mars'))

        * mass: spacecraft mass at departure [kg]
        * Tmax: maximum allowed thrust [N]
        * Isp: spacecarft engine specific impulse [Isp]
        * Vinf_0: allowed maximum starting velocity [km/s]
        * Vinf_f: allowed maximum arrival velocity [km/s]
                  (if negative it is interpreted as a minimum arrival velocity)
        * nseg: number of segments used for the impulsive transcription
        * departure: departure planet (a PyKEP planet)
        * target: arrival planet (a PyKEP planet)
        """
        try:
            import PyKEP
        except ImportError:
            raise ImportError(
                "Error while trying 'import PyKEP': is PyKEP installed?")
        if departure is None:
            departure = PyKEP.planet_ss('earth')
        if target is None:
            target = mars = PyKEP.planet_ss('mars')
        super(py_pl2pl, self).__init__(9 + nseg * 3, 0, 1, 9 + nseg, nseg + 2,
                                       1e-5)
        self.__departure = departure
        self.__target = target
        self.__sc = PyKEP.sims_flanagan.spacecraft(mass, Tmax, Isp)
        self.__Vinf_0 = Vinf_0 * 1000
        self.__Vinf_f = Vinf_f * 1000
        self.__leg = PyKEP.sims_flanagan.leg()
        self.__leg.set_mu(departure.mu_central_body)
        self.__leg.set_spacecraft(self.__sc)
        self.__nseg = nseg
        self.set_bounds([
            0, 10, self.__sc.mass / 10, -abs(self.__Vinf_0),
            -abs(self.__Vinf_0), -abs(self.__Vinf_0), -abs(self.__Vinf_f),
            -abs(self.__Vinf_f), -abs(self.__Vinf_f)
        ] + [-1] * 3 * nseg, [
            3000, 1500, self.__sc.mass,
            abs(self.__Vinf_0),
            abs(self.__Vinf_0),
            abs(self.__Vinf_0),
            abs(self.__Vinf_f),
            abs(self.__Vinf_f),
            abs(self.__Vinf_f)
        ] + [1] * 3 * nseg)
        self.__optimise4mass = optimise4mass
Exemplo n.º 6
0
	((377861107.98154724, 186406866.4808699, 283715.7154025446),
	 (-7615.668664758434, 15593.895465832084, -3.281760584438344))	
	

-- Luís F. Simões, 2012-09-11
"""
# CHECK: the values were obtained by copy-paste from the PDF; this process isn't flawless,
#	sometimes wrong values appear upon pasting. I matched the pasted values copied from 2
#	different PDF readers, but someone should look more closely into the values to make sure
#	we aren't bringing stupid errors into the process just through this.
# CHECK: I'm loading the values into fields of type np.float64. Is there any significant accuracy loss?



# getting Jupiter's orbital parameters
_jupiter = pk.planet_ss('jupiter')
_jupiter_op = [ _jupiter.ref_epoch.mjd ] + list(_jupiter.orbital_elements)
_jupiter_op[1] /= 1000. # convert m -> km
for i in xrange(3,7):   # convert radians -> degrees
	_jupiter_op[i] = degrees( _jupiter_op[i] )
	


# Values from gtoc6_problem_stmt.pdf
# 	Table 4: Keplerian orbit elements of the Galilean Satellites at Epoch = 58849.0 MJD
# 	Table 5: Satellite physical constants
# 	Table 6: Other constants and conversions
body = np.array( [
	# UID   Epoch    a (km)             e                    i (deg)              Node (deg)          w (deg)             M (deg)           R (km)    mu (km^3/s^2)
	[  0. ] + _jupiter_op +                                                                                                               [ 71492.0,  126686534.92180  ],
	[  1.,  58849.,   422029.68714001,  4.308524661773E-03,  40.11548686966E-03,   -79.640061742992,    37.991267683987,  286.85240405645,   1826.5,       5959.916    ],
Exemplo n.º 7
0
	
	>>> body_obj['io'].eph( pk.epoch_from_string('2025-01-01 00:00:00.000') )
	((377861107.98154724, 186406866.4808699, 283715.7154025446),
	 (-7615.668664758434, 15593.895465832084, -3.281760584438344))	
	

-- Luís F. Simões, 2012-09-11
"""
# CHECK: the values were obtained by copy-paste from the PDF; this process isn't flawless,
#	sometimes wrong values appear upon pasting. I matched the pasted values copied from 2
#	different PDF readers, but someone should look more closely into the values to make sure
#	we aren't bringing stupid errors into the process just through this.
# CHECK: I'm loading the values into fields of type np.float64. Is there any significant accuracy loss?

# getting Jupiter's orbital parameters
_jupiter = pk.planet_ss('jupiter')
_jupiter_op = [_jupiter.ref_epoch.mjd] + list(_jupiter.orbital_elements)
_jupiter_op[1] /= 1000.  # convert m -> km
for i in xrange(3, 7):  # convert radians -> degrees
    _jupiter_op[i] = degrees(_jupiter_op[i])

# Values from gtoc6_problem_stmt.pdf
# 	Table 4: Keplerian orbit elements of the Galilean Satellites at Epoch = 58849.0 MJD
# 	Table 5: Satellite physical constants
# 	Table 6: Other constants and conversions
body = np.array(
    [
        # UID   Epoch    a (km)             e                    i (deg)              Node (deg)          w (deg)             M (deg)           R (km)    mu (km^3/s^2)
        [0.] + _jupiter_op + [71492.0, 126686534.92180],
        [
            1., 58849., 422029.68714001, 4.308524661773E-03,