Interplanetary transfer legs#

class pykep.leg.sims_flanagan(rvs=[[1, 0, 0], [0, 1, 0]], ms=1., throttles=[0, 0, 0, 0, 0, 0], rvf=[[0, 1, 0], [-1, 0, 0]], mf=1., tof=pi / 2, max_thrust=1., isp=1., mu=1., cut=0.5)#

This class represents an interplanetary low-thrust transfer between a starting and a final point in the augmented state-space \([\mathbf r, \mathbf v, m]\). The low-thrust transfer is described by a sequence of equally spaced impulses as described in:

Sims, J., Finlayson, P., Rinderle, E., Vavrina, M. and Kowalkowski, T., 2006, August. Implementation of a low-thrust trajectory optimization algorithm for preliminary design. In AIAA/AAS Astrodynamics specialist conference and exhibit (p. 6746).

The low-thrust transfer will be feasible is the state mismatch equality constraints and the throttle mismatch inequality constraints are satisfied.

Args:

rvs (2D array-like): Cartesian components of the initial position vector and velocity [[xs, ys, zs], [vxs, vys, vzs]]. Defaults to [[1,0,0], [0,1,0]].

ms (float): initial mass. Defaults to 1.

throttles (1D array-like): the Cartesan components of the throttle history [ux1, uy1, uz1, ux2, uy2, uz2, …..]. Defaults to a ballistic, two segments profile [0,0,0,0,0,0].

rvf (2D array-like): Cartesian components of the final position vector and velocity [[xf, yf, zf], [vxf, vyf, vzf]]. Defaults to [[0,1,0], [-1,0,0]].

mf (float): final mass. Defaults to 1.

tof (float): time of flight. Defaults to \(\frac{\pi}{2}\).

max_thrust (float): maximum level for the spacecraft thrust. Defaults to 1.

isp (float): specific impulse of the propulasion system. Defaults to 1.

mu (float): gravitational parameter. Defaults to 1.

cut (float): the leg cut, in [0,1]. It determines the number of forward and backward segments. Defaults to 0.5.

Note

Units need to be consistent.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf = pk.leg.sims_flanagan()
compute_mc_grad()#

Computes the gradients of the mismatch constraints. Indicating the initial augmented state with \(\mathbf x_s = [\mathbf r_s, \mathbf v_s, m_s]\), the final augmented state with \(\mathbf x_f = [\mathbf r_f, \mathbf v_f, m_f]\), the total time of flight with \(T\) and the introducing the augmented throttle vector \(\mathbf u = [u_{x0}, u_{y0}, u_{z0}, u_{x1}, u_{y1}, u_{z1} ..., T]\) (note the time of flight at the end), this method computes the following gradients:

\[\frac{\partial \mathbf {mc}}{\partial \mathbf x_s}\]
\[\frac{\partial \mathbf {mc}}{\partial \mathbf x_f}\]
\[\frac{\partial \mathbf {mc}}{\partial \mathbf u}\]
Returns:

tuple [numpy.ndarray, numpy.ndarray, numpy.ndarray]: The three gradients. sizes will be (7,7), (7,7) and (7,nseg*3 + 1)

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf = pk.leg.sims_flanagan()
>>  sf.throttles = [0.8]*3
>>> sf.compute_mc_grad()
compute_mismatch_constraints()#

In the Sims-Flanagan trajectory leg model, a forward propagation is performed from the starting state as well as a backward from the final state. The state values thus computed need to match in some middle control point. This is typically imposed as 7 independent constraints called mismatch-constraints computed by this method.

Returns:

list [float]: The seven mismatch constraints in the same units used to construct the leg.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf = pk.leg.sims_flanagan()
>>> sf.compute_mismatch_constraints()
compute_tc_grad()#

Computes the gradients of the throttles constraints. Indicating the total time of flight with \(T\) and introducing the augmented throttle vector \(\mathbf u = [u_{x0}, u_{y0}, u_{z0}, u_{x1}, u_{y1}, u_{z1} ..., T]\) (note the time of flight at the end), this method computes the following gradient:

\[\frac{\partial \mathbf {tc}}{\partial \mathbf u}\]
Returns:

tuple [numpy.ndarray]: The gradient. Size will be (nseg,nseg*3).

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf = pk.leg.sims_flanagan()
>>  sf.throttles = [0.8]*3
>>> sf.compute_tc_grad()
compute_throttle_constraints()#

In the Sims-Flanagan trajectory leg model implemented in pykep, we introduce the concept of throttles. Each throttle is defined by three numbers \([u_x, u_y, u_z] \in [0,1]\) indicating that a certain component of the thrust vector has reached a fraction of its maximum allowed value. As a consequence, along the segment along which the throttle is applied, the constraint \(u_x ^2 + u_y ^2 + u_z^2 = 1\), called a throttle constraint, has to be met.

Returns:

list [float]: The throttle constraints.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf = pk.leg.sims_flanagan()
>>  sf.throttles = [0.8]*3
>>> sf.compute_throttle_constraints()
property cut#

The leg cut: it determines the number of forward and backward segments.

property isp#

Specific impulse of the propulasion system

property max_thrust#

Maximum spacecraft thruet.

property mf#

Final mass.

property ms#

Initial mass.

property mu#

Central body gravitational parameter.

property nseg#

The total number of segments

property nseg_bck#

The total number of backward segments

property nseg_fwd#

The total number of forward segments

property rvf#

The final position vector and velocity: [[xs, ys, zs], [vxs, vys, vzs]].

property rvs#

The initial position vector and velocity: [[xs, ys, zs], [vxs, vys, vzs]].

property throttles#

The Cartesan components of the throttle history [ux1, uy1, uz1, ux2, uy2, uz2, …..].

property tof#

Time of flight.

class pykep.leg.sims_flanagan_hf(rvs=[[1, 0, 0], [0, 1, 0]], ms=1., throttles=[0, 0, 0, 0, 0, 0], rvf=[[0, 1, 0], [-1, 0, 0]], mf=1., tof=pi / 2, max_thrust=1., isp=1., mu=1., cut=0.5, tol=1e-16)#

This class represents an interplanetary low-thrust transfer between a starting and a final point in the augmented state-space \([\mathbf r, \mathbf v, m]\). The low-thrust transfer is described by a sequence of two-body segments with a continuous and constant thrust defined per segment:

Lantoine, Gregory & Russell, Ryan. (2009). The Stark Model: an exact, closed-form approach to low-thrust trajectory optimization.

The low-thrust transfer will be feasible is the state mismatch equality constraints and the throttle mismatch inequality constraints are satisfied.

Args:

rvs (2D array-like): Cartesian components of the initial position vector and velocity [[xs, ys, zs], [vxs, vys, vzs]]. Defaults to [[1,0,0], [0,1,0]].

ms (float): initial mass. Defaults to 1.

throttles (1D array-like): the Cartesan components of the throttle history [ux1, uy1, uz1, ux2, uy2, uz2, …..]. Defaults to a ballistic, two segments profile [0,0,0,0,0,0].

rvf (2D array-like): Cartesian components of the final position vector and velocity [[xf, yf, zf], [vxf, vyf, vzf]]. Defaults to [[0,1,0], [-1,0,0]].

mf (float): final mass. Defaults to 1.

tof (float): time of flight. Defaults to \(\frac{\pi}{2}\).

max_thrust (float): maximum level for the spacecraft thrust. Defaults to 1.

isp (float): specific impulse of the propulasion system. Defaults to 1.

mu (float): gravitational parameter. Defaults to 1.

cut (float): the leg cut, in [0,1]. It determines the number of forward and backward segments. Defaults to 0.5.

tol (float): the leg tolerance, in [0,1]. It determines the tolerance allowed by the heyoka Taylor integrator. Defaults to 1e-16.

Note

Units need to be consistent.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
compute_mc_grad()#

Computes the gradients of the mismatch constraints. Indicating the initial augmented state with \(\mathbf x_s = [\mathbf r_s, \mathbf v_s, m_s]\), the final augmented state with \(\mathbf x_f = [\mathbf r_f, \mathbf v_f, m_f]\), the total time of flight with \(T\) and the introducing the augmented throttle vector \(\mathbf u = [u_{x0}, u_{y0}, u_{z0}, u_{x1}, u_{y1}, u_{z1} ..., T]\) (note the time of flight at the end), this method computes the following gradients:

\[\frac{\partial \mathbf {mc}}{\partial \mathbf x_s}\]
\[\frac{\partial \mathbf {mc}}{\partial \mathbf x_f}\]
\[\frac{\partial \mathbf {mc}}{\partial \mathbf u}\]
Returns:

tuple [numpy.ndarray, numpy.ndarray, numpy.ndarray]: The three gradients. sizes will be (7,7), (7,7) and (7,nseg*3)

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
>>  sf_hf.throttles = [0.8]*3
>>> sf_hf.compute_mc_grad()
compute_mismatch_constraints()#

In the Sims-Flanagan trajectory leg model, a forward propagation is performed from the starting state as well as a backward from the final state. The state values thus computed need to match in some middle control point. This is typically imposed as 7 independent constraints called mismatch-constraints computed by this method.

Returns:

list [float]: The seven mismatch constraints in the same units used to construct the leg.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
>>> sf_hf.compute_mismatch_constraints()
compute_tc_grad()#

Computes the gradients of the throttles constraints. Indicating the total time of flight with \(T\) and introducing the augmented throttle vector \(\mathbf u = [u_{x0}, u_{y0}, u_{z0}, u_{x1}, u_{y1}, u_{z1} ..., T]\) (note the time of flight at the end), this method computes the following gradient:

\[\frac{\partial \mathbf {tc}}{\partial \mathbf u}\]
Returns:

tuple [numpy.ndarray]: The gradient. Size will be (nseg,nseg*3).

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
>>  sf_hf.throttles = [0.8]*3
>>> sf_hf.compute_tc_grad()
compute_throttle_constraints()#

In the Sims-Flanagan trajectory leg model implemented in pykep, we introduce the concept of throttles. Each throttle is defined by three numbers \([u_x, u_y, u_z] \in [0,1]\) indicating that a certain component of the thrust vector has reached a fraction of its maximum allowed value. As a consequence, along the segment along which the throttle is applied, the constraint \(u_x ^2 + u_y ^2 + u_z^2 = 1\), called a throttle constraint, has to be met.

Returns:

list [float]: The throttle constraints.

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
>>  sf_hf.throttles = [0.8]*3
>>> sf_hf.compute_throttle_constraints()
property cut#

The leg cut: it determines the number of forward and backward segments.

get_state_history()#

Retrieves the state history of the Sims-Flanagan leg at specified times defined by the grid_points_per_segment argument. This defines how many points are saved per segment: if grid_points_per_segment=4, then each segment will include its initial and final state as well as two temporally equidistant points.

Returns:

tuple [numpy.ndarray]: The state history. Size will be (nseg,grid_points_per_segment*7).

Examples:
>>> import pykep as pk
>>> import numpy as np
>>> sf_hf = pk.leg.sims_flanagan_hf()
>>> grid_points_per_segment = 10
>>> sf_hf.get_state_history(grid_points_per_segment)
property isp#

Specific impulse of the propulasion system

property max_thrust#

Maximum spacecraft thruet.

property mf#

Final mass.

property ms#

Initial mass.

property mu#

Central body gravitational parameter.

property nseg#

The total number of segments

property nseg_bck#

The total number of backward segments

property nseg_fwd#

The total number of forward segments

property rvf#

The final position vector and velocity: [[xs, ys, zs], [vxs, vys, vzs]].

property rvmf#

The final position vector, velocity, and mass: [xf, yf, zf, vxf, vyf, vzf, mf].

property rvms#

The initial position vector, velocity, and mass: [xs, ys, zs, vxs, vys, vzs, ms].

property rvs#

The initial position vector and velocity: [[xs, ys, zs], [vxs, vys, vzs]].

property throttles#

The Cartesan components of the throttle history [ux1, uy1, uz1, ux2, uy2, uz2, …..].

property tof#

Time of flight.

property tol#

The tolerance of the Taylor adaptive integrator.