NLPs Subpackage¶
Inheritance Diagram¶

Modules List¶
@authors: Alberto FOSSA’ Giuliana Elena MICELI |
|
@authors: Alberto FOSSA’ Giuliana Elena MICELI |
|
@authors: Alberto FOSSA’ Giuliana Elena MICELI |
Documentation¶
@authors: Alberto FOSSA’ Giuliana Elena MICELI
-
class
latom.nlp.nlp.NLP(body, sc, method, nb_seg, order, solver, snopt_opts=None, rec_file=None)[source] Bases:
objectNLP class transcribes a continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
snopt_opts (dict or None) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details.
rec_file (str or None) – Name of the file in which the computed solution is recorded or None
p (Problem) – OpenMDAO Problem class instance representing the NLP
trajectory (Trajectory) – Dymos Trajectory class instance representing the spacecraft trajectory
p_exp (Problem) – OpenMDAO Problem class instance representing the explicitly simulated trajectory
References
- 1(1,2,3,4)
Gill, Philip E., et al. User’s Guide for SNOPT Version 7.7: Software for Large-Scale Nonlinear Programming, Feb. 2019, p. 126.
-
setup()[source] Set up the Jacobian type, linear solver and derivatives type.
-
exp_sim(rec_file=None)[source] Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
cleanup()[source] Clean up resources.
-
class
latom.nlp.nlp.SinglePhaseNLP(body, sc, method, nb_seg, order, solver, ode_class, ode_kwargs, ph_name, snopt_opts=None, rec_file=None)[source] Bases:
latom.nlp.nlp.NLPSinglePhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by a single phase into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ode_class (ExplicitComponent) – Instance of OpenMDAO ExplicitComponent describing the Ordinary Differential Equations (ODEs) that drive the system dynamics
ode_kwargs (dict) – Keywords arguments to be passed to ode_class
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
phase (Phase) – Dymos Phase object representing the unique phase of the Trajectory class instance
phase_name (str) – Complete name of the Phase instance within OpenMDAO
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes of the discretized phase
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes of the discretized phase
t_all (ndarray) – Time instants corresponding to all discretization nodes [-]
t_state (ndarray) – Time instants corresponding to the state discretization nodes [-]
t_control (ndarray) – Time instants corresponding to the control discretization nodes [-]
idx_state_control (ndarray) – Indexes of the state discretization nodes among the control discretization nodes
tof (float) – Phase time of flight (TOF) [-]
-
set_objective()[source] Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_time_options(tof, t_bounds)[source] Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
set_time_guess(tof)[source] Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp.MultiPhaseNLP(body, sc, method, nb_seg, order, solver, ode_class, ode_kwargs, ph_name, snopt_opts=None, rec_file=None)[source] Bases:
latom.nlp.nlp.NLPMultiPhaseNLP transcribes a continuous-time optimal control problem in trajectory optimization constituted by multiple phases into a Non Linear Programming Problem (NLP) using the libraries OpenMDAO and dymos.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ode_class (tuple) – Instance of OpenMDAO ExplicitComponent describing the Ordinary Differential Equations (ODEs) that drive the system dynamics
ode_kwargs (tuple) – Keywords arguments to be passed to ode_class
ph_name (tuple) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide 1 for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
transcription (list) – List of dymos transcription class instances representing the transcription method, order and segments within each phase
phase (list) – List of dymos Phase object representing the different phases of the Trajectory class instance
phase_name (list) – List of complete names of the Phase instance within OpenMDAO
-
set_time_phase(ti, tof, phase, phase_name)[source] Compute the time grid within one phase to retrieve the time instants corresponding to the state, control and all discretization nodes.
- Parameters
ti (float) – Initial time [-]
tof (float) – Time of flight (TOF) [-]
phase (Phase) – Current phase
phase_name (str) – Current phase name
- Returns
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes
t_state (ndarray) – Time instants on the state discretization nodes [-]
t_control (ndarray) – Time instants on the control discretization nodes [-]
t_all (ndarray) – Time instants on all discretization nodes [-]
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
setup() Set up the Jacobian type, linear solver and derivatives type.
@authors: Alberto FOSSA’ Giuliana Elena MICELI
-
class
latom.nlp.nlp_2d.TwoDimNLP(body, sc, alt, alpha_bounds, method, nb_seg, order, solver, ode_class, ode_kwargs, ph_name, snopt_opts=None, rec_file=None)[source] Bases:
latom.nlp.nlp.SinglePhaseNLPTwoDimNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional trajectory is described in polar coordinates centered at the center of the attracting body.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alpha_bounds (iterable) – Lower and upper bounds on thrust vector direction [rad]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ode_class (ExplicitComponent) – Instance of OpenMDAO ExplicitComponent describing the Ordinary Differential Equations (ODEs) that drive the system dynamics
ode_kwargs (dict) – Keywords arguments to be passed to ode_class
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
- Variables
alt (float) – Orbit altitude [m]
alpha_bounds (ndarray) – Lower and upper bounds on thrust vector direction [rad]
r_circ (float) – Orbit radius [m]
v_circ (float) – Orbital velocity [m/s]
guess (TwoDimGuess) – Initial guess to be provided before solving the NLP
-
set_states_options(theta, u_bound=None)[source] Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_controls_options(throttle=True)[source] Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True)[source] Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True)[source] Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimConstNLP(body, sc, alt, theta, alpha_bounds, tof, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, u_bound=None)[source] Bases:
latom.nlp.nlp_2d.TwoDimNLPTwoDimConstNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines is supposed to have a constant magnitude throughout the whole phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
theta (float) – Guessed spawn angle [rad]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of TOF [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_options(theta, tof, t_bounds, u_bound=None)[source] Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of TOF [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimAscConstNLP(body, sc, alt, theta, alpha_bounds, tof, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='lower')[source] Bases:
latom.nlp.nlp_2d.TwoDimConstNLPTwoDimAscConstNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional ascent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines is supposed to have a constant magnitude throughout the whole phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
theta (float) – Guessed spawn angle [rad]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default islower
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, tof, t_bounds, u_bound=None) Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of TOF [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimDescConstNLP(body, sc, alt, vp, theta, alpha_bounds, tof, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='upper')[source] Bases:
latom.nlp.nlp_2d.TwoDimConstNLPTwoDimDescConstNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional descent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines is supposed to have a constant magnitude throughout the whole phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
theta (float) – Guessed spawn angle [rad]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default isupper
- Variables
vp (float) – Velocity at the periapsis of the Hohmann transfer where the final powered descent is initiated [m/s]
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, tof, t_bounds, u_bound=None) Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
tof (float) – Guessed time of flight [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of TOF [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimVarNLP(body, sc, alt, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, guess, snopt_opts=None, rec_file=None, check_partials=False, u_bound=None, fix_final=False)[source] Bases:
latom.nlp.nlp_2d.TwoDimNLPTwoDimVarNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
guess (TwoDimGuess) – Initial guess for the NLP solution
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is Nonefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
- Variables
guess (TwoDimGuess) – Initial guess for the NLP solution
-
set_options(theta, t_bounds, u_bound=None)[source] Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimAscVarNLP(body, sc, alt, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='lower', fix_final=False)[source] Bases:
latom.nlp.nlp_2d.TwoDimVarNLPTwoDimAscVarNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional ascent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [-]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default islowerfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None) Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimDescVarNLP(body, sc, alt, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='upper', fix_final=False)[source] Bases:
latom.nlp.nlp_2d.TwoDimVarNLPTwoDimDescVarNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional descent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default isupperfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None) Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimVToffNLP(body, sc, alt, alt_safe, slope, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, guess, snopt_opts=None, rec_file=None, check_partials=False, u_bound=None, fix_final=False)[source] Bases:
latom.nlp.nlp_2d.TwoDimVarNLPTwoDimVToffNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional ascent/descent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase. An appropriate path constraint is imposed on the spacecraft state to guarantee a vertical take-off or landing.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alt_safe (float) – Minimum altitude above the Moon surface to be maintained by the spacecraft far from the launch site [m]
slope (float) – Slope of the path constraint on the spacecraft radius and angle close to the launch site. Higher the value, steeper the ascent/descent [-]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
guess (TwoDimGuess) – Initial guess for the NLP solution
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is Nonefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
- Variables
alt_safe (float) – Minimum altitude above the Moon surface to be maintained by the spacecraft far from the launch site [m]
slope (float) – Slope of the path constraint on the spacecraft radius and angle close to the launch site. Higher the value, steeper the ascent [-]
guess (TwoDimGuess) – Initial guess for the NLP solution
-
set_options(theta, t_bounds, u_bound=None)[source] Set the states and controls options and the path constraint.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimAscVToffNLP(body, sc, alt, alt_safe, slope, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='lower', fix_final=False)[source] Bases:
latom.nlp.nlp_2d.TwoDimVToffNLPTwoDimAscVToffNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional ascent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase. An appropriate path constraint is imposed on the spacecraft state to guarantee a vertical take-off.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alt_safe (float) – Minimum altitude above the Moon surface to be maintained by the spacecraft far from the launch site [m]
slope (float) – Slope of the path constraint on the spacecraft radius and angle close to the launch site. Higher the value, steeper the ascent [-]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default islowerfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None) Set the states and controls options and the path constraint.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimDescVLandNLP(body, sc, alt, alt_safe, slope, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='upper', fix_final=True)[source] Bases:
latom.nlp.nlp_2d.TwoDimVToffNLPTwoDimAscVToffNLP class transcribes a two-dimensional, continuous-time optimal control problem in trajectory optimization into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-dimensional descent trajectory is described in polar coordinates centered at the center of the attracting body. The thrust delivered by the spacecraft engines varies in magnitude during the phase. An appropriate path constraint is imposed on the spacecraft state to guarantee a vertical landing.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Orbit altitude [m]
alt_safe (float) – Minimum altitude above the Moon surface to be maintained by the spacecraft far from the launch site [m]
slope (float) – Slope of the path constraint on the spacecraft radius and angle close to the launch site. Higher the value, steeper the descent [-]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default isupperfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalse
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None) Set the states and controls options and the path constraint.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_2d.TwoDimDescTwoPhasesNLP(body, sc, alt, alt_switch, vp, theta, alpha_bounds, tof, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, fix='alt')[source] Bases:
latom.nlp.nlp.MultiPhaseNLPTwoDimDescTwoPhasesNLP transcribes a continuous-time optimal control problem for a two-dimensional descent trajectory into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The two-phases transfer is constituted by an initial deorbit burn to lower the periapsis of the departure orbit, an Hohmann transfer, a first powered phase from its periapsis to a predetermined altitude or time to go and a final vertical descent at full thrust.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Periselene altitude at which the powered descent is initiated [m]
alt_switch (float) – Altitude at which the vertical descent is triggered [m]
vp (float) – Periselene velocity at which the powered descent is initiated [m/s]
theta (float) – Guessed spawn angle [rad]
alpha_bounds (iterable) – Lower and upper bounds on thrust vector direction [rad]
tof (iterable) – Guessed time of flight for the two phases [s]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (tuple) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix (str, optional) –
altto trigger the vertical phase at fixed altitude equal to alt_switch,timeto trigger the vertical phase at fixed time to go equal to the second component of tof. Default isalt
- Variables
alt (float) – Periselene altitude at which the powered descent is initiated [m]
alt_switch (float) – Altitude at which the vertical descent is triggered [m]
rp (float) – Periselene radius at which the powered descent is initiated [m]
r_switch (float) – Radius at which the vertical descent is triggered [m]
vp (float) – Periselene velocity at which the powered descent is initiated [m/s]
alpha_bounds (iterable) – Lower and upper bounds on thrust vector direction [rad]
tof (iterable) – Guessed time of flight for the two phases [s]
fix (str, optional) –
altto trigger the vertical phase at fixed altitude equal to alt_switch,timeto trigger the vertical phase at fixed time to go equal to the second component of tof. Default isalt
-
set_options(theta, t_bounds)[source] Set the time, states and control options for both phases and add the NLP objective.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (iterable) – Time of flight bounds expressed as fraction of tof [-]
-
set_initial_guess(theta, check_partials=False)[source] Set the initial guess for the NLP solution as simple linear interpolation of the Boundary Conditions.
- Parameters
theta (float) – Guessed spawn angle [rad]
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
False
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_time_phase(ti, tof, phase, phase_name) Compute the time grid within one phase to retrieve the time instants corresponding to the state, control and all discretization nodes.
- Parameters
ti (float) – Initial time [-]
tof (float) – Time of flight (TOF) [-]
phase (Phase) – Current phase
phase_name (str) – Current phase name
- Returns
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes
t_state (ndarray) – Time instants on the state discretization nodes [-]
t_control (ndarray) – Time instants on the control discretization nodes [-]
t_all (ndarray) – Time instants on all discretization nodes [-]
-
setup() Set up the Jacobian type, linear solver and derivatives type.
@authors: Alberto FOSSA’ Giuliana Elena MICELI
-
class
latom.nlp.nlp_heo_2d.TwoDimLLO2HEONLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, u_bound='lower', fix_final=True)[source] Bases:
latom.nlp.nlp_2d.TwoDimVarNLPTwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled as a single phase ascent trajectory from the departure LLO to the apoapsis of the arrival HEO. The thrust magnitude is allowed to vary over time.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – LLO altitude [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or
None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default isNonerec_file (str or
None, optional) – Name of the file in which the computed solution is recorded orNone. Default isNonecheck_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseu_bound (str or
None, optional) – Bounds on spacecraft radial velocity betweenlowerandupperorNone. Default islowerfix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isTrue
-
set_states_options(theta, u_bound=None)[source] Set the states variables options.
- Parameters
theta (float) – Unit reference value for spawn angle [rad]
u_bound (str or
None, optional) – Bounds on spacecraft radial velocity betweenlowerandupperorNone. Default islower
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess(check_partials=False, fix_final=False, throttle=True) Set the initial guess for the iterative solution of the NLP.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_options(theta, t_bounds, u_bound=None) Set options on state and control variables, time and objective function.
- Parameters
theta (float) – Guessed spawn angle [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_heo_2d.TwoDimLLO2ApoNLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False, params=None)[source] Bases:
latom.nlp.nlp_2d.TwoDimNLPTwoDimLLO2HEONLP transcribes a continuous-time optimal control problem for a two-dimensional transfer trajectory from a Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled as a single phase ascent trajectory from the departure LLO to the apoapsis of the arrival HEO. The thrust magnitude is allowed to vary over time.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – LLO altitude [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (tuple) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int) – Number of segments in which each phase is discretized
order (int) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (str) – Name of the phase within OpenMDAO
snopt_opts (dict or
None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default isNonerec_file (str or
None, optional) – Name of the file in which the computed solution is recorded orNone. Default isNonecheck_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falseparams (dict or
None, optional) – Optional parameters to be passed when a continuation method is employed and the NLP guess is not defined orNone. Default isNone
- Variables
guess (TwoDimLLO2HEOGuess or
None) – Initial guess orNoneif continuation is used
-
add_timeseries_output(names=('a', 'eps', 'h'))[source] Adds the semi-major axis, specific energy and specific angular momentum magnitude to the time series outputs of the phase.
- Parameters
names (iterable) – List of strings corresponding to the names of the variables to be added to the outputs
-
set_options(rp, vp, thetaf, tof, t_bounds=None)[source] Set the states, controls and time options, add the design parameters and boundary constraints, define the objective of the optimization.
- Parameters
rp (float) – Unit reference value for lengths [m]
vp (float) – Unit reference value for velocities [m/s]
thetaf (float) – Unit reference value for spawn angle [rad]
tof (float) – Guessed time of flight [s]
t_bounds (iterable or
None, optional) – Time of flight lower and upper bounds expressed as fraction of tof [-]
-
set_initial_guess(check_partials=False, fix_final=False, throttle=False)[source] Set the initial guess for a single solution or the first solution of a continuation procedure.
- Parameters
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsefix_final (bool, optional) –
Trueif the final time is fixed,Falseotherwise. Default isFalsethrottle (bool, optional) –
Trueof variable thrust,Falseotherwise
-
set_continuation_guess(tof, states, controls, check_partials=False)[source] Set the initial guess for the solution
k+1as the optimal transfer found for the solutionkduring a continuation procedure.- Parameters
tof (float) – Time of flight for the previous optimal solution [s]
states (ndarray) – States on the states discretization nodes for the previous optimal solution
controls (ndarray) – Controls on the controls discretization nodes for the previous optimal solution
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
False
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_controls_options(throttle=True) Set options on control variables.
- Parameters
throttle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_initial_guess_interpolation(bcs=array([[1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.], [1., 1.]]), check_partials=False, throttle=True) Set the initial guess for the solution of the NLP interpolating the Boundary Conditions (BCs) imposed on the state and control variables.
- Parameters
bcs (ndarray, optional) – Boundary Conditions on state and control variables. Default is all ones
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
Falsethrottle (bool, optional) –
Truefor variable thrust magnitude,Falseotherwise. Default is ‘True`
-
set_objective() Set the NLP objective as the minimization of the opposite of the final spacecraft mass.
-
set_states_options(theta, u_bound=None) Set options on the state variables of the NLP.
- Parameters
theta (float) – Reference value for spawn angle [rad]
u_bound (str or None, optional) – Bounds on spacecraft radial velocity between
lowerandupperor None. Default is None
-
set_time_guess(tof) Compute the time grid on the phase to retrieve the time instants corresponding to states, controls and all discretization nodes.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
-
set_time_options(tof, t_bounds) Set the time options on the phase.
- Parameters
tof (float) – Phase time of flight (TOF) [s]
t_bounds (tuple) – Time of flight lower and upper bounds expressed as a fraction of tof
-
setup() Set up the Jacobian type, linear solver and derivatives type.
-
class
latom.nlp.nlp_heo_2d.TwoDim3PhasesLLO2HEONLP(body, sc, alt, rp, t, alpha_bounds, t_bounds, method, nb_seg, order, solver, ph_name, snopt_opts=None, rec_file=None, check_partials=False)[source] Bases:
latom.nlp.nlp.MultiPhaseNLPTwoDim3PhasesLLO2HEONLP transcribes an optimal control problem for a three-phases ascent trajectory from a circular Low Lunar Orbit (LLO) to an Highly Elliptical Orbit (HEO) into a Non Linear Programming Problem (NLP) using the OpenMDAO and dymos libraries.
The transfer is modeled with a first powered phase at maximum thrust to leave the initial LLO, and intermediate coasting phase and a second powered phase to inject in the target HEO.
- Parameters
body (Primary) – Instance of Primary class representing the central attracting body
sc (Spacecraft) – Instance of Spacecraft class representing the spacecraft
alt (float) – Periselene altitude at which the powered descent is initiated [m]
rp (float) – HEO periapsis radius [m]
t (float) – HEO period [s]
alpha_bounds (iterable) – Lower and upper bounds on thrust vector direction [rad]
t_bounds (tuple) – Time of flight bounds expressed as fraction of tof [-]
method (str) – Transcription method used to discretize the continuous time trajectory into a finite set of nodes, allowed
gauss-lobatto,radau-psandrunge-kuttanb_seg (int or tuple) – Number of segments in which each phase is discretized
order (int or tuple) – Transcription order within each phase, must be odd
solver (str) – NLP solver, must be supported by OpenMDAO
ph_name (tuple) – Name of the phase within OpenMDAO
snopt_opts (dict or None, optional) – SNOPT optional settings expressed as key-value pairs. Refer to the SNOPT User Guide for more details. Default is None
rec_file (str or None, optional) – Name of the file in which the computed solution is recorded or None. Default is None
check_partials (bool, optional) – Check the partial derivatives computed analytically against complex step method. Default is
False
- Variables
guess (TwoDim3PhasesLLO2HEOGuess) – Initial guess for the iterative NLP solution
tof_adim (ndarray) – Time of flight in non-dimensional units [-]
-
set_initial_guess_phase(state_nodes, control_nodes, phase_name)[source] Set the initial guess for a given Phase.
- Parameters
state_nodes (ndarray) – Indexes corresponding to the states discretization nodes within the specified transcription
control_nodes (ndarray) – Indexes corresponding to the controls discretization nodes within the specified transcription
phase_name (str) – Name of the current Phase object
-
cleanup() Clean up resources.
-
exp_sim(rec_file=None) Explicitly simulate the implicitly obtained optimal solution using Scipy solve_ivp method.
-
set_time_phase(ti, tof, phase, phase_name) Compute the time grid within one phase to retrieve the time instants corresponding to the state, control and all discretization nodes.
- Parameters
ti (float) – Initial time [-]
tof (float) – Time of flight (TOF) [-]
phase (Phase) – Current phase
phase_name (str) – Current phase name
- Returns
state_nodes (ndarray) – Indexes corresponding to the state discretization nodes
control_nodes (ndarray) – Indexes corresponding to the control discretization nodes
t_state (ndarray) – Time instants on the state discretization nodes [-]
t_control (ndarray) – Time instants on the control discretization nodes [-]
t_all (ndarray) – Time instants on all discretization nodes [-]
-
setup() Set up the Jacobian type, linear solver and derivatives type.